Filter mapping specifies an unknown filter name ----filter标签在web.xml里的顺序

 <filter-mapping>
        <filter-name>adminOperateLogFilter</filter-name>
        <url-pattern>/*</url-pattern>
   </filter-mapping>
   <filter>
        <filter-name>adminOperateLogFilter</filter-name>
        <filter-class>com.berheley.exam.web.filter.AdminOperateLogFilter</filter-class>
    </filter>


这样写启动服务器时报错Filter mapping specifies an unknown filter name adminOperateLogFilter

将这两块换个顺序就没问题了,web.xml信息的加载是有顺序的,filter在mapping之前必须要让服务器找到其定义。

 <filter>
        <filter-name>adminOperateLogFilter</filter-name>
        <filter-class>com.berheley.exam.web.filter.AdminOperateLogFilter</filter-class>
    </filter>
   <filter-mapping>
        <filter-name>adminOperateLogFilter</filter-name>
        <url-pattern>/*</url-pattern>
   </filter-mapping>







你可能感兴趣的:(web.xml)