1.首先在jsp页面中写一段神奇的JAVA代码
<% String path = request.getContextPath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; %>
2.再base标签中使用
<base href="<%=basePath%>">
原文:https://www.cnblogs.com/max-hou/p/11066451.html