根本原因是 request.getRequestDispatcher将当前文件的路径给改了
解决:
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
然后在需要写路径的地方加上 <%=basePath%>
搞定。