更新时间:2023-11-17 23:08:40
首先, / WEB -INF
无法从外部访问。
First, /WEB-INF
is not accessible from the outside.
其次,如果您使用 /images/temp.jpg
,浏览器将从根目录加载图像Web服务器,而不是来自Web应用程序的根目录(在上下文路径下部署)。
Second, if you use /images/temp.jpg
, the browser will load images from the root of the web server, and not from the root of your web-app (which is deployed under a context path).
使用JSTL < c :url>
标记,用于从网络应用的根目录生成绝对路径:
Use the JSTL <c:url>
tag to generate absolute paths from the root of the web-app:
<img src="<c:url value='/images/temp.jpg'/>" alt=.../>