public abstract class BaseAction extends ActionSupport implements ServletRequestAware, SessionAware {
protected HttpServletRequest request;// 请求的request对象
protected Map session;//session对象
public void setServletRequest(HttpServletRequest request) {
this.request = request;
}
public void setRequest(Map request){
this.session = request;
}
}
1、ServletRequestAware这个接口中的方法是setServletRequest(HttpServletRequest request) 可以获得这次请求的request对象
2、RequestAware这个接口中的方法是setRequest(Map request) 它只能够获得这次请求中包含request对象中全部attributes的一个map对象