This class can obtain some request addresses, which are used when customizing struts2 tags
1 //Get value Stack2Map cont= This. Getstack (). GetContext (); 3Strutsrequestwrapper req=(Strutsrequestwrapper) cont.get (strutsstatics.http_request); 4 //gets the address of the request action5String Url= (String) req.getattribute ("Javax.servlet.forward.request_uri");6System.out.println ("Pagecomponent.start ()" +URL);7 8 //gets the full path of the JSP page where the label is located9StringBuffer Stringbuffer=req.getrequesturl ();//http://localhost: 8080/struts2hibernatespring/list.jspTenSystem.out.println ("Pagecomponent.start ()" +stringbuffer.tostring ()); One A //gets the address of the request background, where the value of the parameter -Object Object=req.getattribute ("PageNo"); -System.out.println ("Pagecomponent.start ()"); the //Key--->value - //javax.servlet.forward.query_string--> (GET request parameter string) pageno=1&seachname=%e5%b0%9a%e6%99%93%e9%a3%9e - //javax.servlet.forward.request_uri--> (Get request path to method name)/struts2hibernatespring/studentaction!querystudent - //javax.servlet.forward.context_path--> (Get project name)/struts2hibernatespring + //javax.servlet.forward.servlet_path--> (Gets the requested action name +method name)/struts2hibernatespring - //Struts.request_uri---> (GET Request Path to method name)/struts2hibernatespring/studentaction!querystudent + //Struts.view_uri--(Gets the path of the JSP returned by the struts request)/list.jsp A //__cleanup_recursion_counter---> 1 at //characterencodingfilter.filtered--> True - //struts.actionmapping--->actionmapping{name= ' studentaction ', namespace= '/', method= ' querystudent ', extension= ' null ', Params=null, result=null} - //Org.springframework.web.context.request.async.WebAsyncManager.WEB_ASYNC_MANAGER--->[email protected] f892d - //struts.valuestack--->[email protected] -Enumeration<string> pd=req.getattributenames (); - while(Pd.hasmoreelements ()) { inString namestring=pd.nextelement (); -Object object2=Req.getattribute (namestring); toSystem.out.println ("Pagecomponent.start ()" +object2); + } - View Code
Struts2 in Strutsrequestwrapper class