如何在struts 中获得request respones session
构架基类 action 继承基类
public class BaseAction implements ServletRequestAware,ServletResponseAware,SessionAware,ServletContextAware {
protected Map<String, Object> session;
protected transient HttpServletRequest request;
protected transient HttpServletResponse response;
protected transient ServletContext context;
public void setServletRequest(HttpServletRequest request) {
this.request = request;
}
public void setServletResponse(HttpServletResponse response) {
this.response = response;
}
public void setSession(Map<String, Object> session) {
this.session = session;
}
public void setServletContext(ServletContext context) {
this.context = context;
}
}