request.getRequestURI 与request.getServletPath() 差异

request.getRequestURI 与request.getServletPath() 区别

 

路径:resin/webapps/my_proj/test/request.jsp

http://localhost:8080/my_proj/test/request.jsp?***

 

request.getRequestURI() /my_proj/test/request.jsp
request.getRequestURL() http://localhost:8080/my_proj/test/request.jsp
request.getContextPath() /my_proj 带/WEB-INF的目录地址
request.getServletPath()  /test/request.jsp

 

貌似request.getRequestURI() 为request.getContextPath()+request.getServletPath()

你可能感兴趣的:(request,servlet,uri)