原文:getContextPath、getServletPath、getRequestURI,getRealPath的區別

假定你的web application 項目名稱為news,你在瀏覽器中輸入請求路徑:http: localhost: news main list.jsp 則執行下面向行代碼后打印出如下結果: System.out.println request.getContextPath 可返回站點的根路徑。也就是項目的名字打印結果: news System.out.println request.get ...

2016-12-29 13:33 0 6424 推薦指數:

查看詳情

getContextPathgetServletPathgetRequestURI區別

假定你的web application 名稱為news,你在瀏覽器中輸入請求路徑: http://localhost:8080/news/main/list.jsp 則執行下面向行代碼后打印出如下結果: 1、 System.out.println(request.getContextPath ...

Wed Nov 23 19:45:00 CST 2016 0 9184
getContextPathgetServletPathgetRequestURI區別

假定你的工程名稱為projects,你在瀏覽器中輸入請求路徑: http://127.0.0.1:8080/projects/pages/newForm.jsp 則執行下面向行代碼后打印出如下結果:1、 System.out.println(request.getContextPath ...

Tue Jul 31 23:40:00 CST 2012 1 16525
request.getServletPath(),request.getContextPath()

2018-11-24 16:34:33 1. getServletPath():獲取能夠與“url-pattern”中匹配的路徑,注意是完全匹配的部分,*的部分不包括。 2. getPageInfo():與getServletPath()獲取的路徑互補,能夠得到的是“url-pattern”中 ...

Sun Nov 25 00:36:00 CST 2018 0 1757
getRequestURI,getRequestURL的區別

轉自:http://www.cnblogs.com/JemBai/archive/2010/11/10/1873764.html test1.jsp======================= ...

Mon Oct 19 19:32:00 CST 2015 0 3698
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM