过滤器配置

配置过滤器在servlet前执行。

 1         <filter>  
 2                 <filter-name>HiddenHttpMethodFilter</filter-name>  
 3                 <filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>  
 4         </filter>  
 5         <filter-mapping>  
 6                 <filter-name>HiddenHttpMethodFilter</filter-name>  
 7                 <servlet-name>spring</servlet-name>  
 8         </filter-mapping>
 9         <servlet>
10         <servlet-name>spring</servlet-name>
11         <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
12         <init-param>
13             <param-name>contextConfigLocation</param-name>
14             <param-value>classpath:dispatcher.xml</param-value>
15         </init-param>
16     </servlet>
17         <servlet-mapping>
18         <servlet-name>spring</servlet-name>
19         <url-pattern>*.html</url-pattern>
20     </servlet-mapping>

 

    <filter>
        <filter-name>HibernateFilter</filter-name>
        <filter-class>my.package.HibernateThreadFilter</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>HibernateFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

 

posted @ 2014-09-09 17:15  LeonGo  阅读(371)  评论(0编辑  收藏  举报