今天郁闷了一下午,代码在别的jsp都能正常,在我新建的jsp中就不行,终于找到元凶啦:
我们在myeclipse 新建jsp文件,都包括这几句话:
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<base href="<%=basePath%>">
这几句话是相对路径不能用的元凶,把这三句话删掉一切ok!