获取 项目路径

复制代码
<%
    String path = request.getContextPath();   //返回值: /project_name
//同 ${pageContext.request.contextPath}
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; //返回值: http://localhost:8080/project_name/ %>

<head>
  <base href="<%=basePath%>">
</head>
复制代码

 

posted @   scmath  阅读(116)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示