码迷,mamicode.com
首页 > 其他好文 > 详细

Struct2中自定义的Filter无效

时间:2016-06-24 10:51:05      阅读:135      评论:0      收藏:0      [点我收藏+]

标签:

解决办法,把自定义的Filter配置放在struct2前

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" 
    xmlns="http://java.sun.com/xml/ns/javaee" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
    http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
    
    <filter>
        <filter-name>LogFilter</filter-name>
        <filter-class>com.*.LogFilter</filter-class>
    </filter>

    <filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>LogFilter</filter-name>
        <url-pattern>*.jsp</url-pattern>
    </filter-mapping>
    
    <filter-mapping>
        <filter-name>LogFilter</filter-name>
        <url-pattern>*.do</url-pattern>
    </filter-mapping>
    
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    ...
</web-app>

 

Struct2中自定义的Filter无效

标签:

原文地址:http://www.cnblogs.com/season2009/p/5613229.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!