原文:getContextPath、getServletPath、getRequestURI的區別

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

2012-07-31 15:40 1 16525 推薦指數:

查看詳情

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
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