方法一:修改过滤规则为<url-pattern>/*.action</url-pattern>
方法二:
2.0.*版本default.properties文件:struts.action.extension=action
2.1.6版本:struts.action.extension=action,,
这个后缀是过滤所有
修改这个属性即可
PS:struts2过滤器不推荐用org.apache.struts2.dispatcher.FilterDispatcher。
文档如下:“Deprecated. Since Struts 2.1.3, use StrutsPrepareAndExecuteFilter instead or StrutsPrepareFilter and StrutsExecuteFilter if needing using the ActionContextCleanUp filter in addition to this one”
2.1.3以上版本推荐用StrutsPrepareAndExecuteFilter,StrutsPrepareFilter ,StrutsExecuteFilter,ActionContextCleanUp
还有一个办法,是修改struts.xml的配置参数,如:
<constant name="struts.action.excludePattern" value="/servlet/.*,/fck/.*" />
其中的value值是正则表达式,可以写多个,只要匹配表达式的URL访问都不会被struts2进行Filter了。