web.xml中ActionContextCleanUp的配置作用
来源:互联网 发布:微店商品怎么在淘宝 编辑:程序博客网 时间:2024/04/30 01:24
为了使用WebWork,我们只需要在web.xml配置FilterDispatcher一个过滤器即可,阅读一下FilterDispatcher的JavaDoc和源码,我们可以看到它调用了:
finally
{
ActionContextCleanUp.cleanUp(req);
}
在ActionContextCleanUp中,有这样的代码:
req.setAttribute(CLEANUP_PRESENT, Boolean.TRUE);
如果FilterDispatcher检测到这个属性,就不会清除ActionContext中的内容了,而由ActionContextCleanUp后续的代码来清除,保证了一系列的Filter访问正确的ActionContext。actionContextcleanup延长action中属性的生命周期,包括自定义属性,以便在jsp页面中进行访问,让actionContextcleanup过滤器来清除属性,不让action自己清除。
文档中提到,如果用到SiteMesh的Filter或者其他类似Filter,那么设置顺序是:
ActionContextCleanUp filter
SiteMesh filter
FilterDispatcher
所以最后我们的web.xml应该类似这样:
<filter>
<filter-name>ActionContextCleanUp</filter-name>
<filter-class>com.opensymphony.webwork.dispatcher.ActionContextCleanUp</filter-class>
</filter>
<filter>
<filter-name>sitemesh</filter-name>
<filter-class>com.opensymphony.webwork.sitemesh.FreeMarkerPageFilter</filter-class>
</filter>
<filter>
<filter-name>webwork</filter-name>
<filter-class>com.opensymphony.webwork.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>ActionContextCleanUp</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>sitemesh</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>webwork</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
- web.xml中ActionContextCleanUp的配置作用
- struts2 使用sitemesh web.xml配置ActionContextCleanUp的作用
- web.xml配置ActionContextCleanUp (org.apache.struts2.dispatcher.ActionContextCleanUp)
- web.xml的配置中配置作用
- Struts2中ActionContextCleanUp作用
- Struts2中ActionContextCleanUp作用
- ActionContextCleanUp的作用
- ActionContextCleanUp的作用
- .ActionContextCleanUp的作用
- ActionContextCleanUp的作用
- ActionContextCleanUp的作用
- ActionContextCleanUp的作用
- ActionContextCleanUp过滤器的作用
- ActionContextCleanUp的作用
- ActionContextCleanUp的作用
- ActionContextCleanUp的作用
- web.xml的配置中<context-param>配置作用
- web.xml的配置中<context-param>配置作用
- CString转char的方法总结
- How to inline ASM in C (gcc)
- 使用 Google AJAX API
- JVM学习笔记(二)------Java代码编译和执行的整个过程
- AVIFile,AVIFileOpen,AVIFileCreateStream....制做AVI文件,基相实现方法
- web.xml中ActionContextCleanUp的配置作用
- Best Practices for Speeding Up Your Web Site
- 關於Oracle中的nvl另類使用
- STUN在SIP中的工作原理及过程
- directshow学习1
- IDP终于搞定了,可以准备上程序上App Store了!
- Android2.1中的 drawable(hdpi,ldpi,mdpi) 的区别
- 从今天起,开始在博客上转载《疯狂的程序员》
- Error loading GrooveUtil.dll