request.getRequestURI 與request.getServletPath() 區別

killalllsd發表於2011-02-16

路徑: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()

相關文章