首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

HttpServletRequest.getRequestUri不能获取forward先期的uri解决

2012-11-16 
HttpServletRequest.getRequestUri不能获取forward之前的uri解决当调用?RequestDispatcher.forward(javax.

HttpServletRequest.getRequestUri不能获取forward之前的uri解决

当调用?RequestDispatcher.forward(javax.servlet.ServletRequest, javax.servlet.ServletResponse)后,再调用javax.servlet.ServletRequest的getRequestUr方法得到的是forward后的uri,之前的uri得不到了。servlet规范明确规定了这种情况:getRequestURI

/**   57    * Standard Servlet 2.4+ spec request attributes for forward URI and paths.   58    * <p>If forwarded to via a RequestDispatcher, the current resource will see its   59    * own URI and paths. The originating URI and paths are exposed as request attributes.   60    */   61   public static final String FORWARD_REQUEST_URI_ATTRIBUTE = "javax.servlet.forward.request_uri";

?

参照代码:

http://www.docjar.com/html/api/org/springframework/web/util/WebUtils.java.html

http://www.docjar.com/html/api/org/springframework/web/util/WebUtils.java.html

?

?

热点排行