获取 项目路径

<%
    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 @ 2018-11-26 15:24  scmath  阅读(116)  评论(0编辑  收藏  举报