<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<head>
<base href="<%=basePath %>"> <!--http://127.0.0.1:8080/-->
</head>
<body>
<img src="iii.png"> <!--http://127.0.0.1:8080/ iii.png-->
<a href="sss.html">http://127.0.0.1:8080/sss.html</a>
</body>
注:服务器情况。有可能出问题
转载于:https://blog.51cto.com/xuliangjun/1712832