因为ActionSupport是你整合了Spring之后用的,再Spring的包里,光用Struts2的话,Action是不用继续任何东西的,不过一般都会有一个baseaction,让你的action都去继承这个东西,里面带了点你比较常用的对象
public class BaseAction implements Serializable,RequestAware,SessionAware,ApplicationAware,ServletRequestAware,ServletResponseAware,ServletContextAware{
private static final long serialVersionUID = -8737956568774373323L;
protected Map
protected Map
protected Map
protected HttpServletRequest httpServletRequest;
protected HttpServletResponse httpServletResponse;
protected HttpSession httpSession;
protected ServletContext httpApplication;
public void setSession(Map
this.session = session;
}
public void setRequest(Map
this.request = request;
}
public void setApplication(Map
this.application = application;
}
public void setServletRequest(HttpServletRequest httpServletRequest) {
this.httpServletRequest = httpServletRequest;
this.httpSession = httpServletRequest.getSession();
}
public void setServletResponse(HttpServletResponse httpServletResponse) {
this.httpServletResponse = httpServletResponse;
}
public void setServletContext(ServletContext servletContext) {
this.httpApplication = servletContext;
}
public String execute() throws Exception{
return "success";
}
}