要想使用request可以使用下面的方法:
在web点xml中配置一个监听
view plainprint?
org.springframework.web.context.request.RequestContextListener
之后就可以在程序使用了
view
plainprint?
HttpServletRequest request =
((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();