标签:
1.注解法
@Autowired private HttpServletRequest request;
2. 在web.xml中配置一个监听
HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
3.直接在参数中引入
public String hello(HttpServletRequest request,HttpServletResponse response)
如何在Struts2中获取request对象
HttpServletRequest request = ServletActionContext.getRequest();
标签:
原文地址:http://www.cnblogs.com/taohj/p/4313290.html