<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Ordinary hut

    人間一福地,勝似天仙宮
    posts - 61, comments - 50, trackbacks - 0, articles - 1
    ActionContext是被存放在當(dāng)前線程中的,獲取ActionContext也是從ThreadLocal中獲取的。所以在執(zhí)行攔截器、 action和result的過程中,由于他們都是在一個(gè)線程中按照順序執(zhí)行的,所以可以可以在任意時(shí)候在ThreadLocal中獲取 ActionContext。
    ActionContext包括了很多信息,比如Session、Application、Request、Locale、ValueStack等,其中 ValueStack可以解析ognl表達(dá)式,來動(dòng)態(tài)后去一些值,同時(shí)可以給表達(dá)式提供對象。值棧是建立在ognl的基礎(chǔ)之上的。

    HttpServletRequest等對象是如何與struts2的ActionContext互通的
    是struts2重新實(shí)現(xiàn)了HttpServletRequest接口,就是類StrutsRequestWrapper,看下struts2的說明:
    All Struts requests are wrapped with this class, which provides simple JSTL accessibility. This is because JSTL works with request attributes, so this class delegates to the value stack except for a few cases where required to prevent infinite loops. Namely, we don't let any attribute name with "#" in it delegate out to the value stack, as it could potentially cause an infinite loop. For example, an infinite loop would take place if you called: request.getAttribute("#attr.foo").
    說明struts重新包裝了request接口,所以如果用request.getAttribute()的話,是執(zhí)行了StrutsRequestWrapper類,在這個(gè)類里面有訪問ActionContext的代碼:
    public class StrutsRequestWrapper extends HttpServletRequestWrapper {

        
    /**
         * The constructor
         * 
    @param req The request
         
    */
        
    public StrutsRequestWrapper(HttpServletRequest req) {
            
    super(req);
        }

        
    /**
         * Gets the object, looking in the value stack if not found
         *
         * 
    @param s The attribute key
         
    */
        
    public Object getAttribute(String s) {
            
    if (s != null && s.startsWith("javax.servlet")) {
                
    // don't bother with the standard javax.servlet attributes, we can short-circuit this
                
    // see WW-953 and the forums post linked in that issue for more info
                return super.getAttribute(s);
            }

            ActionContext ctx 
    = ActionContext.getContext();
            Object attribute 
    = super.getAttribute(s);
            

    在這里實(shí)現(xiàn)了getAttribute方法,然而沒有實(shí)現(xiàn)全部,所以只有用getAttribute方法才能獲取ActionContext中的信息
    但是它繼承了sun的HttpServletRequestWrapper類,所以其他的方法還是用的默認(rèn)實(shí)現(xiàn),也就是不能訪問到ActionContext中的信息
    jstl標(biāo)簽會(huì)觸發(fā)request等的getAttribute方法,所以jstl也能獲取到ActionContext的數(shù)據(jù),比如Struts2的Action中的屬性等等。
    主站蜘蛛池模板: 成人免费在线观看网站| 99久9在线|免费| 好爽…又高潮了免费毛片| 亚洲美女视频免费| 国产午夜无码精品免费看动漫| 狠狠亚洲狠狠欧洲2019| 一级毛片人与动免费观看| 亚洲国产小视频精品久久久三级| 国产精品亚洲综合| 天堂亚洲免费视频| 国产成人免费片在线视频观看| 日韩国产欧美亚洲v片| 国产色爽女小说免费看| 色www免费视频| 国产精品亚洲美女久久久| 中国一级特黄高清免费的大片中国一级黄色片 | 亚洲经典千人经典日产| 精品免费久久久久久成人影院| 亚洲av无码成人精品国产| 免费在线黄色网址| 国产精品内射视频免费| 久久久久久久综合日本亚洲 | 中文字幕无码免费久久9一区9| 亚洲欧洲自拍拍偷午夜色无码| 久久久久久久99精品免费| 亚洲一区二区三区国产精品无码| 成人黄页网站免费观看大全| 美女黄频免费网站| 国产A在亚洲线播放| 999国内精品永久免费观看| 亚洲成AV人片在WWW| 国产日产亚洲系列| 69式互添免费视频| 直接进入免费看黄的网站| 久久亚洲国产精品一区二区| 最近免费中文字幕mv电影| 亚洲av日韩av永久无码电影| 亚洲小说区图片区另类春色| 91黑丝国产线观看免费| 极品美女一级毛片免费| 久久精品国产亚洲AV香蕉|