今天研究了一下午,图片显示问题。
jsp中获取绝对路径的方法:
String contextPath = request.getContextPath();
String path = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort() + contextPath;
然后<img src="<%=path%>/.../scene.jpg" ALT=""/>
有一点一定要记住!image,css文件夹千万不要放到WEB-INF文件下,因为WEB项目,WEB-INF是受保护,无法通过路径直接访问的。