如果要用到webroot下的文件夹的路径
直接
发现图片显示不了
加了这段话就没问题了
<%
String path = request.getContextPath();
String basePath = request.getScheme()+”://”+request.getServerName()+”:”+request.getServerPort()+path+”/”;
%>
/image/a/b/c.jpg />
本文介绍了一种在Web应用中解决图片无法加载显示的问题的方法。通过设置正确的图片路径,确保图片资源可以从webroot目录下正确加载。具体实现包括获取当前上下文路径、服务器名称、端口等信息。
如果要用到webroot下的文件夹的路径
直接
发现图片显示不了
加了这段话就没问题了
<%
String path = request.getContextPath();
String basePath = request.getScheme()+”://”+request.getServerName()+”:”+request.getServerPort()+path+”/”;
%>
/image/a/b/c.jpg />

被折叠的 条评论
为什么被折叠?