zoukankan      html  css  js  c++  java
  • ActionContextCleanUp

    一般情况下,如果要用sitemesh或者其他过滤器时,是要放在filterDispatcher前面的,在调用完所有的dofilter()后,filterDispatcher会清空actionContext,其他过滤器如果要使用valueStack等等struts的特性时, 就得不到想要的值.

    ActionContextCleanUp延长action中属性的生命周期,包括自定义属性,以便在jsp页面中进行访问,让actionContextcleanup过滤器来清除属性,不让action自己清除。

        为了使用WebWork,我们只需要在web.xml配置FilterDispatcher一个过滤器即可,阅读一下FilterDispatcher的JavaDoc和源码,我们可以看到它调用了:

     finally
     {
                ActionContextCleanUp.cleanUp(req);
     } 

    在ActionContextCleanUp中,有这样的代码:

    req.setAttribute(CLEANUP_PRESENT, Boolean.TRUE); 

    如果FilterDispatcher检测到这个属性,就不会清除ActionContext中的内容了,而由ActionContextCleanUp后续的代码来清除,保证了一系列的Filter访问正确的ActionContext.

    ActionContextCleanUp过滤器的位置一般在前面:

     ActionContextCleanUp filter
     SiteMesh filter
     FilterDispatcher

  • 相关阅读:
    open stack总结
    Nginx操作命令
    Nginx 配置详解
    Linux 常用命令-- top
    CEPH 使用SSD日志盘+SATA数据盘, 随OSD数目递增对性能影响的递增测试
    MyCat水平分库
    MyCat垂直分库
    MyCat基本知识
    utf8mb4复杂昵称问题
    Power安装linux-BIG ENDIAN mysql编译安装
  • 原文地址:https://www.cnblogs.com/wangjianbg/p/3443444.html
Copyright © 2011-2022 走看看