使用MYECLIPSE正确导入STRUTS需要的JAR包之后,我建立一个ACTION类,然后继承ACTIONSUPPORT类,
使用MYECLIPSE正确导入STRUTS需要的JAR包之后,我建立一个ACTION类,然后继承ACTIONSUPPORT类,但是无法正确弹出我需要的ACTIONSUPPORT的类包。这是怎么回事呢?
因为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<String,Object> request;
protected Map<String,Object> session;
protected Map<String,Object> application;
protected HttpServletRequest httpServletRequest;
protected HttpServletResponse httpServletResponse;
protected HttpSession httpSession;
protected ServletContext httpApplication;
public void setSession(Map<String, Object> session) {
this.session = session;
}
public void setRequest(Map<String, Object> request) {
this.request = request;
}
public void setApplication(Map<String, Object> application) {
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";
}
}