getServletPath()
来源:互联网 发布:csgo和彩虹六号知乎 编辑:程序博客网 时间:2024/06/05 05:37
http://localhost:8080/myfirstServlet/index.jsp,注,通过index。jsp转到GenerServ的
getContextPath:返回,/myfirstServlet
getRequestURl:返回,/myfirstServlet/servlet/GenerServ
getServletPath
java.lang.String getServletPath()
- Returns the part of this request's URL that calls the servlet. This path starts with a "/" character and includes either the servlet name or a path to the servlet, but does not include any extra path information or a query string. Same as the value of the CGI variable SCRIPT_NAME.
This method will return an empty string ("") if the servlet used to process this request was matched using the "/*" pattern.
返回请求URL中调用该servlet的那一部分,这个路径是以"/"开头的,要么包含servlet名,要么包含一个走到该servlet的路径,但是不包含任何额外的路径信息,或者一个查询字符串,如同CGI的变量SCRIPT_NAME,如果这个servlet的请求路径是用“/*”来匹配的,那么这个方法将返回""
附上两篇博文,便于理解:request.getServletPath()和request.getPathInfo()用法
getContextPath、getServletPath、getRequestURI的区别
0 0
- getServletPath
- getServletPath()
- request.getServletPath();
- getServletPath方法
- request.getContextPath. getServletPath
- HttpServletRequest getServletPath() getContextPath() getRequestURI()
- Servlet:getServletPath 与 getPathInfo
- request.getContextPath. getServletPath
- getServletPath与getRequestURI
- getContextPath getServletPath getRequestURI
- getContextPath、getServletPath、getRequestURI的区别
- 关于request.getServletPath()的讨论
- getContextPath、getServletPath、getRequestURI的区别
- getContextPath、getServletPath、getRequestURI的区别
- getContextPath、getServletPath、getRequestURI的区别
- getContextPath、getServletPath、getRequestURI的区别
- getContextPath、getServletPath、getRequestURI的区别
- getContextPath、getServletPath、getRequestURI的区别
- 王朝 第九周 个十百
- 第八周 求倒数和
- Hadoop WordCount(Streaming,Python,Java三合一)
- angularjs学习笔记(二) 自定义filter
- Android项目中引用外部项目library失败的原因
- getServletPath()
- 网络编程综述
- 【hdu 1003】Max Sum dp水
- android向上拖动查看图文详情控件
- Thinking in Java读书笔记(第一章)
- gcd,高效(魔法GCD,uva 1642)
- C语言经典-socket编程
- 王朝第九周 输出我喜欢
- rxJava+ViewPager实现aotuBanner