在spring的普通类中:
HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
request.getSession();
在Struts的普通类中:
HttpServletRequest request = ServletActionContext.getRequest();
request.getSession();
HttpServletResponse response =ServletActionContext.getResponse();