1 <%@ page contentType="text/html;charset=UTF-8" language="java" %> 2 <% 3 //动态获取base标签的路径 4 String basePath = request.getScheme() //http 5 + "://" 6 + request.getServerName() //ip 7 + ":" 8 + request.getServerPort() //port 9 + request.getContextPath() //工程名 10 + "/"; 11 %> 12 <%--<%=basePath%>--%> 13 <!-- 此base路径对应web目录--> 14 <base href="<%=basePath%>">