2.获取HttpServletRequest
实现:ServletRequestAware借口
public void setServletRequest(HttpServletRequest request) {
this.request = request;
}
3.获取HttpServletResponse
实现:ServletResponseAware
public void setServletResponse(HttpServletResponse response) {
this.response = response;
}
4.获取HttpSession
httpSession = ServletActionContext.getRequest().getSession();
5.获取ServletContext
实现:ServletContextAware
public void setServletContext(ServletContext servletContext) {
this.servletContext = servletContext;
}
6.获取Map<String,Object> session
实现:SessionAware
public void setSession(Map<String, Object> session) {
this.session = session;
}
本文出自 “素颜” 博客,请务必保留此出处http://suyanzhu.blog.51cto.com/8050189/1563139