情况:在web.xml中配置一个servlet映射路径为/test,但是struts2的filermapping为/*.
这样,servlet就不会被映射到。
解决:
<constant name="struts.action.excludePattern" value="/YourServlet"/>
参考:
Why the Filter is mapped with /* and how to configure explicit exclusions (since 2.1.7)
In the example above we've mapped the Struts 2 dispatcher to /*, so Struts 2 has a crack at all incoming requests. This is because Struts 2 serves static content from its jar files, including Dojo JavaScript files (if using S2.0, or the Dojo plugin in S2.1+) and FreeMarker templates for the Struts 2 tags that produce HTML.
If we change the filter mapping to something else, for example /*.html, we must take this in to account and extract the content that would normally be served from the Struts 2 jar files, or some other solution.
Since Struts 2.1.7, you are able to provide a comma seperated list of patterns for which when matching against the
request URL the Filter will just pass by. This is done via the configuration option struts.action.excludePattern, for example in your struts.xml
<struts>
<constant name="struts.action.excludePattern" value=".*unfiltered.*,.*\\.nofilter"/>
...
</struts>
http://struts.apache.org/2.2.1/docs/webxml.html
分享到:
相关推荐
Struts2拦截器(Interceptor) Struts2拦截器(Interceptor)
解决Struts2中的中文乱码。该代码是用作Struts2的拦截器中
struts2常用拦截器,struts2经常用到的拦截器,熟悉熟悉
该例子为struts2注解与拦截器demo,利用myEclipse8.5开发,导入刚才后,自动加载所需struts2的jar包,可以直接运行,是初学struts2注解、拦截器很好的例子,保证10分钟学会2种技术,愿意分享给大家。
struts2 Interceptor拦截器 http://whitewolf.0fees.net
使用Struts2实现用户权限拦截、重点是掌握拦截器的使用和配置方法,通过案例的学习,就能掌握struts中拦截器的使用方法,让我们能快速上手
Struts2拦截器.ppt Struts2拦截器.ppt Struts2拦截器.ppt
关于struts2 拦截器的详细的解释及其在开发中对struts2的拦截器的应用和拦截器在框架中的作用.
详细说明了struts2中拦截器的使用。并且通过一个小例子讲解了拦截器的具体使用
Struts2拦截器源程序 Struts2拦截器源程序 Struts2拦截器源程序 Struts2拦截器源程序 Struts2拦截器源程序
struts2,Interceptor struts2拦截器实例,两套实例,一套是针对单个的action配置的,另一套实例是针对全局的action配置的拦截器interceptor
基于struts2的拦截器测试,实现了页面的跳转,中间过程的拦截
struts2 用拦截器 实现用户权限登录 可以直接运行,只单单用到struts的东西。
Struts2的拦截器的使用详解实例 博文链接:https://zmx.iteye.com/blog/457434
Struts2内建拦截器的简要介绍,Struts2内建拦截器的简要介绍,Struts2内建拦截器的简要介绍
综合使用servlet filter与struts2 interceptor对权限进行验证。
STRUTS2:拦截器Interceptor
由于struts2标签的性能不好,项目组决定不使用,但是如果用struts2自带的拦截器防止重复提交又必须struts标签,所以只好自定拦器实现
Struts2的核心,拦截器的应用!!!
struts2拦截器应用小例子,与大家共分享