Filter 配置多个URL-PATTERN

一、完全错误的方式

[html]  view plain copy
  1. <filter>  
  2.     <filter-name>authority</filter-name>  
  3.     <filter-class>com.util.AuthorityFilter</filter-class>  
  4. </filter>  
  5. <filter-mapping>  
  6.     <filter-name>authority</filter-name>  
  7.     <url-pattern>/pages/cmm/*;/pages/genbill/*</url-pattern>  
  8. </filter-mapping>  


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

[html]  view plain copy
  1. <filter>  
  2.     <filter-name>authority</filter-name>  
  3.     <filter-class>com.util.AuthorityFilter</filter-class>  
  4. </filter>  
  5. <filter-mapping>  
  6.     <filter-name>authority</filter-name>  
  7.     <url-pattern>/pages/cmm/*</url-pattern>  
  8.        <url-pattern>/pages/genbill/*</url-pattern>  
  9. </filter-mapping>  

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

[html]  view plain copy
  1. <filter>  
  2.     <filter-name>authority</filter-name>  
  3.     <filter-class>com.util.AuthorityFilter</filter-class>  
  4. </filter>  
  5. <filter-mapping>  
  6.     <filter-name>authority</filter-name>  
  7.        <url-pattern>/pages/genbill/*</url-pattern>  
  8. </filter-mapping>  
  9. <filter-mapping>  
  10.     <filter-name>authority</filter-name>  
  11.     <url-pattern>/pages/cmm/*</url-pattern>  
  12. </filter-mapping>  

你可能感兴趣的:(Filter 配置多个URL-PATTERN)