Struts2_API

2021-02-13 02:16

阅读:563

标签:action   requests   struts   ret   map   ring   post   get   public   

1.访问servletAPI方法1


 

  

 1 public String execute() throws Exception {
 2         //request域对象==》map (struts2并不推荐使用原生request域对象)
 3         //不推荐
 4         Map requestScope = (Map) ActionContext.getContext().get("request");
 5         //推荐
 6         ActionContext.getContext().put("name", "requestTom");
 7         //session域对象==》map
 8         Map sessionScope = ActionContext.getContext().getSession();
 9         sessionScope.put("name", "sessionTom");
10         //application域对象==》map
11         Map applicationScope = ActionContext.getContext().getApplication();
12         applicationScope.put("name", "applicationTom");
13         return SUCCESS;
14     }

 1 request:${requestScope.name}
2 session:${sessionScope.name}
3 application:${applicationScope.name}
 

Struts2_API

标签:action   requests   struts   ret   map   ring   post   get   public   

原文地址:https://www.cnblogs.com/rocker-pg/p/8467960.html


评论


亲,登录后才可以留言!