filter 指定多个Url-pattern

通过指定多个<filter-mapping>可以指定多个url-pattern,下面是个例子: 

web.xml配置:
<filter>  
  <filter-name>encodingFilter</filter-name>  
  <filter-class>com.cs.cms.filter.EncodingFilter</filter-class>  
  <init-param>  
   <param-name>encoding</param-name>  
   <param-value>gbk</param-value>  
  </init-param>  
 </filter>  
 <filter-mapping>  
  <filter-name>encodingFilter</filter-name>  
  <url-pattern>*.html</url-pattern>  
 </filter-mapping>  
  
<filter-mapping>  
  <filter-name>encodingFilter</filter-name>  
  <url-pattern>*.jsp</url-pattern>  
 </filter-mapping>

 

你可能感兴趣的:(url-pattern)