request获取路径
1、request.getRequestURL() 返回的是完整的url,包括Http协议,端口号,servlet名字和映射路径,但它不包含请求参数。
2、request.getRequestURI() 得到的是request URL的部分值,并且web容器没有decode过的
3、request.getContextPath() 返回 the context of the request.
4、request.getServletPath() 返回调用servlet的部分url.
5、request.getQueryString() 返回url路径后面的查询字符串
示例: 当前url:http://localhost:8080/CarsiLogCenter_new/idpstat.jsp?action=idp.sptopn
request.getRequestURL() :http://localhost:8080/CarsiLogCenter_new/idpstat.jsp
request.getRequestURI() :/CarsiLogCenter_new/idpstat.jsp
request.getContextPath():/CarsiLogCenter_new
request.getServletPath(): /idpstat.jsp
request.getQueryString():action=idp.sptopn
request获取路径的更多相关文章
- jsp request 获取路径
这篇教程不错:http://zjutsoft.iteye.com/blog/1084260 自己试验如下: System.out.println("-----------------serv ...
- request获取路径方式
从request获取各种路径总结 request.getRealPath("url"); // 虚拟目录映射为实际目录 request.getRealPath("./&q ...
- [转]java中通过request获取路径中的不同信息
原文地址:http://blog.csdn.net/lv_shijun/article/details/40819859 aa为工程中的项目名 bb为webRoot下的文件夹 1.request.ge ...
- request获取各种路径总结、页面跳转总结。
页面跳转总结 JSP中response.sendRedirect()与request.getRequestDispatcher().forward(request,response)这两个对象都可以使 ...
- request 获取各种路径
从request获取各种路径总结 request.getRealPath("url"); // 虚拟目录映射为实际目录 request.getRealPath("./&q ...
- request获取各种路径
equest.getRealPath() 这个方法已经不推荐使用了,代替方法是: request.getSession().getServletContext().getRealPath() 在ser ...
- 从request获取各种路径总结
一.获得都是当前运行文件在服务器上的绝对路径 在servlet里用: this.getServletContext().getRealPath() 在struts用: this.getServlet( ...
- 从request获取各种路径总结 request.getRealPath("url")
转载:http://blog.csdn.net/piaoxuan1987/article/details/8541839 equest.getRealPath() 这个方法已经不推荐使用了,代替方法是 ...
- 关于从request对象中获取路径的问题
从request对象中获取路径的问题:例如: 项目名为:tmall_web 请求的servlet名为:loginServlet 示例代码如下: @Override protected void ...
随机推荐
- 问题 C: 「Usaco2010 Dec」奶牛健美操O(∩_∩)O
题目描述 Farmer John为了保持奶牛们的健康,让可怜的奶牛们不停在牧场之间的小路上奔跑.这些奶牛的路径集合可以被表示成一个点集和一些连接 两个顶点的双向路,使得每对点之间恰好有一条简单路径. ...
- ISCONF Redis is configured to save RDB snapshots
MISCONF Redis is configured to save RDB snapshots redis报错: (error) MISCONF Redis is configured to sa ...
- csp-s 66
我向来只在考砸的时候写博客.这次题很水,但是我极没有状态,我T1没看题目前面的话: 不知道这个条件的我蒙蔽的答题.推各种柿子,想这个矩阵的特殊构造,就是同行的构造,然后我T1想了1个多小时,然后死了! ...
- vue , debounce 使用
有时候不想直接在methods中的方法前面加debounce, getFullName: debounce(function() { console.log('my fullname is chent ...
- mailx加163邮箱发邮件
mailx加163邮箱发邮件 参考:https://www.cnblogs.com/myvic/p/9579954.html 配置 $ yum install mailx -y $ vim /etc/ ...
- linux中dd相关命令骚操作
一.dd如何快速将磁盘写满 方法一: dd if=/dev/zero of=/tmp/file bs=1G count=10 # 参数解释 1. if=文件名:输入文件名,缺省为标准输入.即指定源文件 ...
- Linux(ubuntu)下切换root用户
输入命令su root切换用户,会提示输入root密码,如果不记得或者是没设置过,那么可以输入sudo passwd root来设置密码,会让你输入两次密码确认.输入完即可使用su root命令切换r ...
- [HTML] 学HTML写的第一第二个网页
①第一个网页 <h2>英雄联盟(电子竞技类游戏)</h2> <p><b>(英雄联盟)</b>(简称lol)是由美国<i>Roit ...
- centos下安装composer
centos下,yum 安装没效果,按照官网的安装方法: curl -sS https://getcomposer.org/installer | php mv composer.phar /usr/ ...
- ubuntu 16.04 上使用pybind11进行C++和Python代码相互调用 | Interfacing C++ and Python with pybind11 on ubuntu 16.04
本文首发于个人博客https://kezunlin.me/post/a41adc1/,欢迎阅读! Interfacing C++ and Python with pybind11 on ubuntu ...