论坛首页· 友情链接申请·申请版主· 广告投放· 道具中心· 设为首页· 收藏本站
发新话题
打印

servlet中的几个路径有关的方法

servlet中的几个路径有关的方法

在编写JSP/Servlet应用时常常需要从传入的链接中提取一些信息。HttpServletRequest提供了多个方法,这些方法之间容易混淆。总结并举例如下,希望能对大家有所帮助。
举例:http://localhost:7001/myservlet/somepath/test?someparam=somevalue
request.getPathInfo()
:返回/somepath/test
request.getRequestURL()
:返回http://localhost:7001/myservlet/somepath/test
request.getRequestURI()
:返回/myservlet/somepath/test
request.getServletPath()
:返回/myservlet
request.getQueryString()
:返回someparam=somevalue
好好学习,天天向上!

TOP

不要嘛

提示: 作者被禁止或删除 内容自动屏蔽

TOP

TOP

翻译公司来支持您!

提示: 作者被禁止或删除 内容自动屏蔽

TOP

发新话题