HttpServletRequest常用获取URL的方法
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
HttpServletRequest常用获取URL的方法的更多相关文章
- 【javaWeb】HttpServletRequest常用获取URL的方法
1.request.getRequestURL() 返回的是完整的url,包括Http协议,端口号,servlet名字和映射路径,但它不包含请求参数. 2.request.getRequestURI( ...
- java中HttpServletRequest常用获取url、资源名等方法总结
HttpServletRequest客户端获取请求,客户端通过HTTP协议访问服务器时,HTTP请求头中的所有信息都封装在这个对象中.所以我们能够从对象中获取相应信息 端口 request.get ...
- nginx 常用的 URL 重写方法
转自:http://www.jbxue.com/article/4727.html Nginx中一些常用的URL 重写方法介绍,有需要的朋友可以参考下.url重写应该不陌生,不管是SEO URL 伪静 ...
- JavaScript&jQuery获取url参数方法
JavaScript&jQuery获取url参数方法 function getUrlParam(name){ var reg = new RegExp("(^|&)" ...
- HttpServletRequest 获取URL的方法及区别
HttpServletRequest 获取请求的URL的方法有: 1.request.getRequestURL() 返回的是完整的url,包括Http协议,端口号,servlet名字和映射路径,但它 ...
- JavaScript获取URL参数方法总汇
现在做页面基本都用AJAX,因此导致操作很麻烦,每次都需要通过JS获取url中的参数值,网上所搜到很多资料,没一次能记住的,也不知道在哪个项目中使用过,现在又需要通过JS获取url参数,因此不能在偷懒 ...
- jquery 获取url 参数方法 以及 解决url中文问题
//jQuery 动态给a 标签赋值 跳转 新的页面打开. /* <a class="btn btn-success" id="test" target= ...
- js获取url参数方法
function GetQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&] ...
- request获取url的方法总结
辣么多属性.方法 不用就忘了 ,当需要用的时候挠头也想不到,现在总结一下 以备用 例如:http://localhost/testweb/default.aspx 1.Request.Applic ...
随机推荐
- 使用CSS3动画属性实现360°无限循环旋转【代码片段】
使用CSS3的animation动画属性实现360°无限循环旋转. 代码片段: <div id="test"> <img src="/CSS3/img/ ...
- SQLserver CASE WHEN
declare @shuzu int set @shuzu=1 select (case @shuzu when '1' then '444' when '2'then '555' end) as ' ...
- JSHelper时间格式化
Helper.prototype.FormatDate = function (format) { var _now = new Date(); var o = { "M+": _ ...
- ScorllView中嵌套listView与Viewpager的焦点问题处理
解决进入该页面直接显示中的listview而不是从页面最顶端开始显示在setAdapter后调用listview的smoothScrollTo(0,20); 解决listview只能显示一条 需要重写 ...
- 我们的html
http://files.cnblogs.com/files/eeroom/mac-Bootstrap.rar http://files.cnblogs.com/files/eeroom/CSharp ...
- hash表C语言实现
算法参考<算法导论>第11章散列表.采用链地址法解决冲突. #include <stdio.h> #include <stdlib.h> #include < ...
- 【Python】一、除法问题及基本操作(逻辑与,if替代switch)及支持中文打印
1.查看版本 C:\Users\XXX>python -V Python 2.7.1 2.除法问题(不要整除) from __future__ import division tmp=0x3ec ...
- Map循环的三种方法
import java.util.HashMap; import java.util.Iterator; import java.util.Map; public class MapTest { pu ...
- 第七周——Linux内核如何装载和启动一个可执行程序
万子惠 + 原创作品转载请注明出处 + <Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029000 part1 实验 ...
- oracle的分析函数over 及开窗函数
转:http://www.2cto.com/database/201310/249722.html oracle的分析函数over 及开窗函数 一:分析函数over Oracle从8.1.6开 ...