jsp中的basePath,获取应用的路径
2024-09-05 07:10:32
1
2
3
4
5
|
String path = request.getContextPath(); String basePath = request.getScheme()+ "://" +request.getServerName()+ ":" +request.getServerPort()+path+ "/" ; <base href= "<%=basePath%>" > |
request.getSchema()可以返回当前页面使用的协议,http 或是 https;
request.getServerName()可以返回当前页面所在的服务器的名字;
request.getServerPort()可以返回当前页面所在的服务器使用的端口,就是80;
request.getContextPath()可以返回当前页面所在的应用的名字;
最新文章
- java.net.ConnectException: Connection timed out
- phpspidercookie
- AlwaysOn可用性组测试环境安装与配置(二)--AlwaysOn配置(界面与T-SQL)
- postman 添加环境变量 并 读取变量 作为参数 传入,跑整个场景
- Spring中加载配置文件的方式
- mybatis整合spring 之 基于接口映射的多对一关系
- SpringBoot相关
- iframe-摘自网友
- 13年省赛-B题-连通分量
- Microsoft Visual Studio 2013 Update 1 离线安装程序
- c#利用WebClient和WebRequest获取网页源代码
- soj 1698 Hungry Cow_三角函数
- Weapsy 分析网站架构
- idea + mybatis generator + maven 插件使用
- linkin大话数据结构--Google commons工具类
- wpf图片浏览器,实现缩放平移操作图片切换等功能
- TreeNode.trage的使用
- Mysql SQL分组取每组前几条记录
- Java接口自动化测试之HTTPClient学习(四)
- npm 是干什么的