手动获取request对象
程序员文章站
2022-05-24 14:20:42
...
手动获取request对象
struts2:HttpServletRequest request = ServletActionContext.getRequest();
springMVC:
配置web.xml
<</span>listener>
<</span>listener-class>
org.springframework.web.context.request.RequestContextListener
</</span>listener-class>
</</span>listener>
后台中
HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
springMVC:
配置web.xml
<</span>listener>
<</span>listener-class>
org.springframework.web.context.request.RequestContextListener
</</span>listener-class>
</</span>listener>
后台中
HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
下一篇: mysql主从复制实战