原文:http://blog.csdn.net/u012255097/article/details/53092628

在spring的普通类中:

HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();

request.getSession();

在Struts的普通类中:

HttpServletRequest request = ServletActionContext.getRequest();

request.getSession();

 

HttpServletResponse response =ServletActionContext.getResponse();

05-11 13:28