. , , . , , - , . pageContext , - , ( ). :
(http://www.docjar.com/html/api/org/apache/struts2/ServletActionContext.java.html), , "pageContext":
93 public static PageContext getPageContext() {
94 return (PageContext) ActionContext.getContext().get(PAGE_CONTEXT);
95 }
getContext(). get() , , , PageContext. ?
:
package com.quaternion.action.test;
import com.opensymphony.xwork2.ActionSupport;
public class RequestAccessTest extends ActionSupport{
public String getGreeting(){
return "Hello from Request AccessTest";
}
}
JSP:
<%@taglib prefix="s" uri="/struts-tags"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<body>
<h1>Request Access Test</h1>
<%
HttpServletRequest r = (HttpServletRequest) pageContext.getRequest();
String aGreeting = (String) r.getAttribute("greeting");
System.out.println(aGreeting);
System.out.println("R class is:" + r.getClass().getCanonicalName());
%>
</body>
</html>
:
INFO: Hello from Request AccessTest
INFO: R class is:org.apache.struts2.dispatcher.StrutsRequestWrapper
, StrutsRequestWrapper (, , )...
http://massapi.com/source/struts-2.2.1/src/core/src/main/java/org/apache/struts2/dispatcher/StrutsRequestWrapper.java.html
. , getAttribute .
65, , , , , .
? , , ;)