发布网友 发布时间:2023-10-20 16:43
共1个回答
热心网友 时间:2024-11-30 01:39
在spring的普通类中:
HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();request.getSession();
在Struts的普通类中:
HttpServletRequest request = ServletActionContext.getRequest();request.getSession();
HttpServletResponse response =ServletActionContext.getResponse();