struts2访问web资源
2021-06-15 09:03
标签:bsp 页面 class put web资源 res gen etc context 通过ActionContext访问 Aware方式 jsp页面 struts.xml struts2访问web资源 标签:bsp 页面 class put web资源 res gen etc context 原文地址:http://www.cnblogs.com/lusufei/p/7275563.htmlpublic class TestActionContextAction {
public String execute(){
//获取 ActionContext 对象
ActionContext actionContext = ActionContext.getContext();
//application
Map
public class TestAwareAction implements ApplicationAware, SessionAware, RequestAware
,ParameterAware{
public String execute(){
//1. 向 application 中加入一个属性: applicationKey2 - applicationValue2
application.put("applicationKey", "applicationValue");
//2. 从 application 中读取一个属性 date, 并打印.
System.out.println(application.get("date"));
request.put("requestKey", "requestValue");
session.put("sessionKey", "sessionValue");
return "success";
}
public String save(){
return null;
}
private Map
application : ${applicationScope.applicationKey }
br>br>
session: ${sessionScope.sessionKey }
br>br>
request: ${requestScope.requestKey }
br>br>
parameters ${parameters.name }
action name="TestActionContext" class="com.TestActionContextAction">
result name="success">/actionContext.jspresult>
action>
action name="TestAware" class="com.TestAwareAction">
result>/aware.jspresult>
action>
上一篇:Web应用的目录结构
下一篇:CSS属性操作