在spring的普通类中:
HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
request.getSession();
在Struts的普通类中:
HttpServletRequest request = ServletActionContext.getRequest();
request.getSession();
HttpServletResponse response =ServletActionContext.getResponse();
有不懂的,或者更好的见解可以随时交流!每天都会看的。