上下文路径request.getContextPath();与${pageContext.request.contextPath}
(1) request.getContextPath();与${pageContext.request.contextPath}都是获取上下文路径:
1. request.getContextPath();在普通的java代码中用,当然也可以在jsp中用:<% String contextPath = request.getContextPath(); %>
2. ${pageContext.request.contextPath} jsp中el表达式,在jsp页面中用;
(2) 不同的部署war包名(或者说应用路径名不一样),那么上下文路径不一样:
当在webapps中部署war包为:ROOT.war时,这时上下文路径为默认的:空字符串
当在webapps中部署war包为:platform.war时,这时上下文路径为:/platform
转载于:https://www.cnblogs.com/wenlj/p/5980189.html
上下文路径request.getContextPath();与${pageContext.request.contextPath}相关推荐
- String path = request.getContextPath(....拼装当前网页的相对路径
原文地址 <% String path = request.getContextPath(); String basePath = request.getScheme()+"://&q ...
- java 取上下文路径_取得上下文路径的方式(getContextPath)
jsp可以直接取得取得上下文路径,但是js不能,需要在jsp里设置属性再根据属性获取或者通过window.loaction的方式做处理后取得. 1.通过监听器,获取 1.1web.xml文件配置监听器 ...
- request.getcontextPath() 详解
<%=request.getContextPath()%>是为了解决相对路径的问题,可返回站点的根路径. 但不用也可以,比如<a href="<%=request.g ...
- request.getContextPath()的功能
<% String contextPath = request.getContextPath(); // 得到项目的名字 com.chint.until.SessionInfo session ...
- request.getcontextPath() 详解(转)
本文转自:http://blog.csdn.net/pengxuan/article/details/6604578 <%=request.getContextPath()%>是为了解决相 ...
- request.getContextPath详解
<% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+ ...
- String path = request.getContextPath()和String basePath = request.getScheme()
在JSP当中我们会用此代码来拼接路径,所以此语句是用来拼装当前网页的相对路径的. <% String path = request.getContextPath(); String basePa ...
- jsp中String path = request.getContextPath()的作用
<% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+ ...
- String path = request.getContextPath
<%String path = request.getContextPath();String basePath = request.getScheme()+"://"+re ...
- java中的request对象_java中request对象各种方法的使用实例分析
本文实例讲述了java中request对象各种方法的使用.分享给大家供大家参考,具体如下: request对象是从客户端向服务器端发出请求,包括用户提交的信息以及客户端的一些信息.request对象是 ...
最新文章
- 点、线、面生成mvt(MapBox Vector Tile)格式的瓦片总结
- python记录当前系统时间 生成照片直接命名
- 收藏 | 一文打尽AI、机器学习网络资源!
- python数据处理实例-Python数据分析实例操作
- 机器人编程语言python-10大热门机器人编程语言,你掌握了哪种?
- 2020-09-16 如何在matlab figure中对latex符号进行大写操作
- NAACL 2021 | AWS AI 提出基于对比学习的端到端无监督聚类方法
- 腾讯视频视频下载_如何下载腾讯视频
- memset 和 memcpy 和 memcmp (strncmp遇到\0会中断)
- 继C / C ++之后,微软如何全面采用 Rust 的?
- OpenCV4系统化学习路线图与教程
- 将Alfred与BetterZip整合,提高你的Mac工作效率
- java 汉字 正则_java正则表达式验证汉字
- go语言处理html文件,go语言操作文件实例笔记
- iOS iPhone X底部设置高度 白色底部显示
- iReport简单使用
- error: no viable conversion from 'MyCalendar *' to 'MyCalendar'
- 9-java.sql.SQLException: Incorrect string value: ‘\xE9\x82\xA3\xE5\xB0\xB1‘ for column ‘content‘
- mac外接键盘HOME,END键问题
- 慧据价值 链接未来丨第八届数据技术嘉年华大会全议程呈现
热门文章
- 1.1顺序表的初始化及基本操作(菜单实现)
- 运行elasticsearch时报错:could not find java; set JAVA_HOME or ensure java is in PATH
- C++11 非成员函数begin()、end()
- 33. 把数组排成最小的数(C++版本)
- vs2015 hiredis编译使用
- mysql 语句 简书_MySQL基本语句
- python截图保存到内存卡_没有长截图功能,一招即可截下来!
- python requests json_python:解析requests返回的response(json格式)
- hive数据库初始化失败
- 让部署到服务器上的springboot项目持续运行(nohup)