当使用了相对路径 <base href="<%= basePath %>" /> 后,全局都只能使用相对路径

 

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

//  拼接绝对路径

 

当使用了相对路径  <base href="<%= basePath %>" />  后,全局都只能使用相对路径,

否则就会出现路径错误

posted @ 2018-04-09 11:21  由良大小姐  阅读(462)  评论(0编辑  收藏  举报