basePath = request.getScheme()+"://"+request.getServerName()+":"+

来源:互联网 发布:linux php环境搭建 编辑:程序博客网 时间:2024/05/16 00:55

比如,页面内部有一个连接,完整的路径应该是 http://localhost:80/myblog/authen/login.do


request.getSchema()可以返回当前页面使用的协议,就是上面例子中的“http”
request.getServerName()可以返回当前页面所在的服务器的名字,就是上面例子中的“localhost"
request.getServerPort()可以返回当前页面所在的服务器使用的端口,就是80,
request.getContextPath()可以返回当前页面所在的应用的名字,就是上面例子中的myblog



0 0
原创粉丝点击