好贷网好贷款

getRequestURI()与getRequestURL()

发布时间:2016-12-5 4:36:34 编辑:www.fx114.net 分享查询网我要评论
本篇文章主要介绍了"getRequestURI()与getRequestURL()",主要涉及到getRequestURI()与getRequestURL()方面的内容,对于getRequestURI()与getRequestURL()感兴趣的同学可以参考一下。

引于: http://hi.baidu.com/cloudxpc request.getRequestURI() 返回值类似:/xuejava/requestdemo.jsp request.getRequestURL() 返回值类似:http://localhost:8080/xuejava/requestdemo.jsp 附: request.getContextPath() = /hboys request.getLocalAddr() = 127.0.0.1 request.getPathInfo() = null request.getPathTranslated() = null request.getRemoteAddr() = 127.0.0.1 request.getRequestURI() = /hboys/ request.getScheme() = http request.getServerName() = 127.0.0.1 request.getServletPath() = /index.jsp request.getClass() = class org.apache.catalina.connector.RequestFacade request.getHeaderNames() = request.getLocale() = zh_CN request.getLocales() = request.getParameterMap() = {} request.getRequestURL() = http://127.0.0.1:8081/hboys/ request.getUserPrincipal() = null request.getParameterNames() = request.getRealPath("newsPub") = D:\workspace\hboys\WebRoot\newsPub 假定你的web application 名称为news,你在浏览器中输入请求路径: http://localhost:8080/news/main/list.jsp 则执行下面向行代码后打印出如下结果: 1、 System.out.println(request.getContextPath()); 打印结果:/news    2、System.out.println(request.getServletPath()); 打印结果:/main/list.jsp 3、 System.out.println(request.getRequestURI()); 打印结果:/news/main/list.jsp 4、 System.out.println(request.getRealPath("/")); 打印结果:F:\Tomcat 6.0\webapps\news\test

上一篇:CF#230 A题Nineteen
下一篇:简易的学生管理系统

相关文章

相关评论