struts2中的路径是根据action确定的,而非jsp的真实路径确定的,所以使用绝对路径更好。
在jsp中"/"代表整个站点根路径,不是web-app根路径
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
得到的路径是http://localhost:8080/xxx/
<base href="<%=basePath%>"> 表示所有的连接前面多会加上basepath,从而形成绝对路径