项目路径解析
2013-07-15 08:41
155 查看
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>域名路径解析</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body> 协议名 Scheme =<%=request.getScheme() %><br> 域名 serverName=<%=request.getServerName() %><br> 端口号 serverPort = <%=request.getServerPort() %><br> 项目相对路径 path= <%=path%><br> 项目绝对路径 BasePath= <%=basePath%> <br> </body> </html>今天看到项目组每个页面都使用一个常量来定义项目名,以便于以后的移植,自己还是感觉这种方法更简单点于是记录下来。
相关文章推荐
- 从web项目中解析xml文件出现(\src\bean.xml (系统找不到指定的路径。))
- xml解析项目中的xml文件,路径如何写?
- [开源项目]:GMap.Net开发之地址解析与路径查找
- VC 项目中可以使用的路径宏
- Videojs 项目开发使用解析
- Cocos2d-x 3.2 大富翁游戏项目开发-第七部分 获取角色路径_3
- ATS项目更新(1) CC视图与备份路径同步
- DLL项目中共享MFC,导出CString等,出现无法解析符号
- java获取项目访问路径的方法
- Web项目中访问路径问题
- js获取项目路径
- spring MVC项目中,欢迎页首页根路径到底是怎么设置的
- 2.SpringBoot构建项目解析
- eclipse中怎么找项目部署的路径和找编译后的class路径
- VS项目中调用他人提供的.lib和.dll文件的用法(绝对路径和相对路径)
- maven项目建立pom.xml报无法解析org.apache.maven.plugins:maven-resources-plugin:2.4.3
- windows linux 下,获取java项目绝对路径的方法
- 第12周 项目4-输出顶点u到v的一条配简单路径
- webpack打包vue项目后,一些文件图片路径找不到的问题解决办法
- T4模板中获取当前项目或解决方案路径