67,513
社区成员
发帖
与我相关
我的任务
分享
Map session = ActionContext.getContext().getSession();
String loninName = (String) session.get("userLoginName");
request.setAttribute("hello", hello);
request.getRequestDispatcher("/action/helloAction.action").forward(request, response);
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.action;*.do</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
<package name="struts2" extends="struts-default">
<action name="helloAction" class="action.HelloAction"></action>
</package>
ActionContext ac=ActionContext.getContext();
String value = (String)ac.get(hello);
System.out.println(value);