在struts中我们经常要用到request,session,application对象,获取它们的代码记录如下。
//获取request
HttpServletRequest request = ServletActionContext.getRequest();
request.setAttribute("key",value);
//获取session
Map session= ActionContext.getContext().getSession();
request.setAttribute("key",value);
//获取application
Map application= ActionContext.getContext().getApplication();
request.setAttribute("key",value);