首页 > 代码库 > Spring MVC获得HttpServletRequest

Spring MVC获得HttpServletRequest

以下代码是获得Spring MVC中的HttpServletRequest

 ServletRequestAttributes attr = (ServletRequestAttributes)
                RequestContextHolder.currentRequestAttributes();
        HttpServletRequest request = attr.getRequest();

这同Struts2里通过ServletActionContext.getRequest()获得HttpServletRequest方式一样。

Spring MVC获得HttpServletRequest