原文: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