1.访问servletAPI方法1
public String execute() throws Exception {
//request域对象==》map (struts2并不推荐使用原生request域对象)
//不推荐
Map<String, Object> requestScope = (Map<String, Object>) ActionContext.getContext().get("request");
//推荐
ActionContext.getContext().put("name", "requestTom");
//session域对象==》map
Map<String, Object> sessionScope = ActionContext.getContext().getSession();
sessionScope.put("name", "sessionTom");
//application域对象==》map
Map<String, Object> applicationScope = ActionContext.getContext().getApplication();
applicationScope.put("name", "applicationTom");
return SUCCESS;
}
request:${requestScope.name}<br> session:${sessionScope.name}<br> application:${applicationScope.name}<br>