`
itmyhome
  • 浏览: 95185 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

${pageContext.request.contextPath}的作用

 
阅读更多

刚开始不知道是怎么回事,在网上也查找了一些资料,看了还是晕。

看了另一个大侠的,终于有了点眉目。

那位大侠在博客中这样写道“然后在网上找,更让我郁闷的事,TMD!网上“抄袭”的真多啊!而且扯了一大堆!关键的真没几个!让很郁闷!我心想:大哥们啊!你们贴在博客上的内容真的看懂了吗?我是看不懂!至少是说得我是很蒙!本来一句话可以搞定的事,偏偏啰嗦一大堆!而且贴的人还是很多!”

${pageContext.request.contextPath}等价于<%=request.getContextPath()%> 或者可以说是<%=request.getContextPath()%>的EL版 意思就是取出部署的应用程序名或者是当前的项目名称

比如我的项目名称是ajax01 在浏览器中输入为http://localhost:8080/ajax01/login.jsp ${pageContext.request.contextPath}或<%=request.getContextPath()%>取出来的就是/ajax01,而"/"代表的含义就是http://localhost:8080

所以我们项目中应该这样写${pageContext.request.contextPath}/login.jsp


分享到:
评论
5 楼 lisha2009 2016-12-20  
终于有个能看懂的了,这个说的很明白,对我很有用
4 楼 jajijo 2016-08-27  
终于有个能看懂的了
3 楼 和尚啊和尚 2015-11-24  
今天终于懂得,以前看的说了一大堆术语,不知道啥意思
2 楼 无天9527 2015-02-03  
讲解的简单明了!
1 楼 niuwenchao 2015-01-28  

相关推荐

    jsp页面中${pageContext.request.contextPath}介绍

    ${pageContext.request.contextPath}是JSP取得绝对路径的方法 例如:浏览器地址栏为”http://localhost:8080/test/index.jsp “ 那么:取出来的就是”http://localhost:8080/test”,简写为”/test” /test 等价于 ...

    java web 登录验证码生成类

    ${pageContext.request.contextPath}/checkcode.jsp"/&gt; 另外在web.xml中配置验证码类的加载: &lt;servlet-name&gt;CheckCodeImage &lt;servlet-class&gt;com.netshop.common.util.CheckCodeImage&lt;/servlet-class&gt; ...

    JavaScript中${pageContext.request.contextPath}取值问题及解决方案

    主要介绍了JavaScript中${pageContext.request.contextPath}取值问题及解决方案的相关资料,需要的朋友可以参考下

    jsp+mysql师生作业互动系统

    &lt;li&gt;&lt;a href="${pageContext.request.contextPath}/student!list"&gt;学生信息管理&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="${pageContext.request.contextPath}/exam!list"&gt;学生作业情况查询&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="${pageContext....

    jsp运行时的问题集合

    自己在实际开发中,发现并解决问题的总结。

    人脸识别研究综述

    人脸识别,用于进行人脸检测.二、javaEE框架学习笔记 2、的涵义: ...其中:“${pageContext.request.contextPath}”就是获取request的绝对路径,它的作用相当于“&lt;%=pageContext.request.contextPath%&gt;” 3、

    springMVC+mybatis

    ${pageContext.request.contextPath}/my/login" method="post"&gt; ${message } 邮箱: 密码: 登录"&gt; ${pageContext.request.contextPath}/my/regist"&gt;注册 ${pageContext.request....

    基于iframe实现类似于ajax的页面无刷新

    form id=”form0″ action=”${pageContext.request.contextPath}/news/baikeAdd.form” enctype=”multipart/form-data” method=”POST” target=”hidden_frame”&gt; … … &lt;/form&gt; &lt;iframe name=’...

    struts2<s:if>使用心得

    href="${pageContext.request.contextPath}/ga/changeTaskAssigment.action?taskInstanceId=&lt;s:property value="id"/&gt;" &gt;我来处理)&lt;/s:if&gt; 受评对象准备评级资料"}'&gt; ${pageContext.request.contextPath}/ga/...

    ext时间控件,可以选择时分秒

    link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/extjs/pulgins/datetime/datetime.css" /&gt; [removed][removed] [removed][removed] [removed][removed] [removed]...

    JSTL高级用法

    ${pageContext.request.contextPath} 服务的web application 的名称 ${pageContext.request.method} 取得HTTP 的方法(GET、POST) ${pageContext.request.protocol} 取得使用的协议(HTTP/1.1、HTTP/1.0) ${...

    kindEditor中关于上传处理

    link rel=”stylesheet” href=”${pageContext.request.contextPath}/common/kingeditor/themes/default/default.css”/&gt; &lt;link rel=”stylesheet” href=”${pageContext.request.contextPath}/common/...

    flash-swf格式计算器使用Object控件嵌入html即可使用(文件内有dom)

    codebase="${pageContext.request.contextPath }/common/plugins/calc/swflash.cab#version=6,0,0,0" id="BAPPFlash116526140886070277838"&gt; value="${pageContext.request.contextPath }/common/plugins/calc...

    轮播jar包

    link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/resources/css/login/login.css?version=20200311" /&gt; &lt;/head&gt; &lt;body&gt; &lt;li&gt;&lt;img src = "${pageContext....

    CONVERT函数方法大全_JAIMY.files ajax test url

    url:"${pageContext.request.contextPath}/module/updateModuleOrder.html", dateType:"json", data:"moduleId="+id+"&num="+demo1.value, type:"post", success:function(result,textStatus){ ...

    jQuery实现标签子元素的添加和赋值方法

    一、在jsp页面中定义&lt;select&gt;标签,如下: 科室: &lt;select class="dept-name-show" style="width: 70%;...var url = "${pageContext.request.contextPath}/getDepts.do";//请求路径 $(".dept-name-show").cli

    layui实现数据表格隐藏列的示例

    ,url:'${pageContext.request.contextPath}/findcustomers' ,cols: [[ {align:'center', title: '编号', sort: true,type:'numbers',width:100} ]] ,page: true }); 我们就会获得一列有序的数列(ps:这里的...

    基于java的企业级应用开发:简单绑定.ppt

    //...省略向用户注册页面跳转方法 @RequestMapping("/registerUser") public String registerUser(User user) { String username = user.getUsername();... } &lt;body&gt; ${pageContext.request.contextPath }/reg

    HTML+CSS实现动态背景登录页面

    主要介绍了HTML+CSS实现动态背景登录页面的相关资料,需要的朋友可以参考下

Global site tag (gtag.js) - Google Analytics