在web。xml中配置一个监听
<listener>
<listener-class>
org.springframework.web.context.request.RequestContextListener
</listener-class>
</listener>
之后就可以在程序使用了
public HttpServletRequest getHttpServletRequest()
{
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
return servletRequestAttributes.getRequest();
}
posted on 2012-09-21 16:51
孤飞燕 阅读(1228)
评论(0) 编辑 收藏 所属分类:
Spring