admin管理员组

文章数量:1122851

filter

一、完全错误的方式

<filter>  <filter-name>authority</filter-name>  <filter-class>com.util.AuthorityFilter</filter-class>  
</filter>  
<filter-mapping>  <filter-name>authority</filter-name>  <url-pattern>/pages/cmm/*;/pages/genbill/*</url-pattern>  
</filter-mapping>  

二、有一定作用,但不能实现需要的效果,只会过滤最下面配置的url-pattern

<filter>  <filter-name>authority</filter-name>  <filter-class>com.util.AuthorityFilter</filter-class>  
</filter>  
<filter-mapping>  <filter-name>authority</filter-name>  <url-pattern>/pages/cmm/*</url-pattern>  <url-pattern>/pages/genbill/*</url-pattern>  
</filter-mapping>  

三、现在给出正确的配置方式

<filter>  <filter-name>authority</filter-name>  <filter-class>com.util.AuthorityFilter</filter-class>  
</filter>  
<filter-mapping>  <filter-name>authority</filter-name>  <url-pattern>/pages/genbill/*</url-pattern>  
</filter-mapping>  
<filter-mapping>  <filter-name>authority</filter-name>  <url-pattern>/pages/cmm/*</url-pattern>  
</filter-mapping> 

 

本文标签: filter