博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
request.getContextPath()
阅读量:7241 次
发布时间:2019-06-29

本文共 429 字,大约阅读时间需要 1 分钟。

hot3.png

String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

request.getSchema()可以返回当前页面使用的协议,http 或是 https; request.getServerName()可以返回当前页面所在的服务器的名字;如果你的应用部署在本机那么其就返回localhost或者127.0.0.1 ,这两个是等价的 request.getServerPort()可以返回当前页面所在的服务器使用的端口,就是8083; request.getContextPath()可以返回当前页面所在的应用的名字;

转载于:https://my.oschina.net/youyoubohexiang/blog/151078

你可能感兴趣的文章
C-遍历二叉树
查看>>
bean的生命周期
查看>>
mysql数据库的基本操作
查看>>
iOS-自定义Alert框
查看>>
LVS四种负载均衡类型,十种调度方法
查看>>
数据持久化之SQLite
查看>>
android4.1+ ListView 不滚动
查看>>
3. 类
查看>>
Axure快速创建原型的示例
查看>>
ssh连接错误的解决办法
查看>>
mac 下面wireshark 找不到网卡
查看>>
我的友情链接
查看>>
Python 6.3 文档测试
查看>>
mysteel Sql
查看>>
Dockerfile中的权限问题及工作目录问题(USER WORKDIR)
查看>>
c#文件读取和写入的方式总结
查看>>
Djano XSS的转义
查看>>
springMVC项目的web.xml文件
查看>>
基础不牢,地动山摇 - OSI模型
查看>>
You (root) are not allowed to access to (crontab)
查看>>