<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!-- base需要放到head中 -->
<base href=" <%=basePath%>">
把这段代码放在head标签中就行了 亲测有效