假定你的web application 名稱為news,你在瀏覽器中輸入請求路徑: http://localhost:8080/news/main/list.jsp 則執行下面向行代碼后打印出如下結果: 1、 System.out.println(request.getContextPath ...
假定你的工程名稱為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 推薦指數:
假定你的web application 名稱為news,你在瀏覽器中輸入請求路徑: http://localhost:8080/news/main/list.jsp 則執行下面向行代碼后打印出如下結果: 1、 System.out.println(request.getContextPath ...
(request.getContextPath()); //可返回站點的根路徑。也就是項目的名字 打印結果:/news 2、Sys ...
出來的輸出效果為: getContextPath是返回的項目上下文的名字(其實也就是項目名); getServletPath是返回的是項目名到當前jsp文件的路徑(意思就是在這個項目首頁到文件的路徑) getRequestURI是返回的是項目名到整個 ...
/request.jsprequest.getContextPath()/jqueryWebrequest.getServletPath()/resource ...
2018-11-24 16:34:33 1. getServletPath():獲取能夠與“url-pattern”中匹配的路徑,注意是完全匹配的部分,*的部分不包括。 2. getPageInfo():與getServletPath()獲取的路徑互補,能夠得到的是“url-pattern”中 ...
test1.jsp======================= <a href ="test.jsp?p=fuck">跳轉到test2</a> test2.jsp==== ...
轉自:http://www.cnblogs.com/JemBai/archive/2010/11/10/1873764.html test1.jsp======================= ...
test1.jsp======================= <a href ="test.jsp?p=fuck">跳轉到test2</a> test2.jsp==== ...