STRUTS2 Source Analysis (i) 111 Strutsrequestwrapper

Source: Internet
Author: User

Strutsrequestwrapper source//Core code: public class Strutsrequestwrapper extends Httpservletrequestwrapper {/** * Note the following comment : Get object, if not found, go to valuestack inside to find * Gets the object, looking in the value of the stack if not found * * @param s the att  Ribute Key */public Object getattribute (String s) {if (s! = null && s.startswith ("Javax.servlet"))        {return Super.getattribute (s); } Actioncontext CTX = Actioncontext.getcontext ();//* * * * * * Call the parent class's GetAttribute () method to get the properties in the request scope * * * * obje        CT attribute = Super.getattribute (s);                if (CTX! = null) {if (attribute = = null) {Boolean alreadyin = false;                Boolean B = (Boolean) ctx.get ("__requestwrapper.getattribute");                if (b! = null) {Alreadyin = B.booleanvalue (); } if (!alreadyin && s.indexof ("#") = = =-1) {try {//* * * * * * * * * * If not found in request, go to Valu        Estack Find * * * * *                 If not found, then try the Valuestack ctx.put ("__requestwrapper.getattribute",                        Boolean.true);                        Valuestack stack = Ctx.getvaluestack ();                            if (stack! = null) {//* * * * Call Findvalue () method, find in Valuestack [first from the object stack (Value stack Contents), if not found, go to the map stack (stack Context) to find]                        attribute = Stack.findvalue (s);                    }} finally {Ctx.put ("__requestwrapper.getattribute", Boolean.false);    }}}} return attribute; }} So: Using the El expression in a JSP page also gives you access to the contents of the Valuestack inside the Struts2: page-to---valuestack.findvalue () Session--Application

STRUTS2 Source Analysis (i) 111 Strutsrequestwrapper

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.