图片未显示使用百里香和春天 [英] Image does not show using thymeleaf and spring
本文介绍了图片未显示使用百里香和春天的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
图片在以下目录中:
/src/main/resources/static/images/logo.png
这是我的HTML标记:
And this is my HTML tag:
<img width="220px" height="70px" th:src="@{/static/images/logo.png}"/>
但是,当我尝试访问图像时,出现此错误:
However, when i'm trying to access the image, this error shows up:
发生意外错误(类型=未找到,状态= 404).没有讯息可用
There was an unexpected error (type=Not Found, status=404). No message available
推荐答案
您在路径中不需要 static
.您应该使用 @ {/images/logo.png}
,因为默认解析器会将/src/main/resources/static/
映射到/
url根据您的情况.
You don't need static
in the path. You should use @{/images/logo.png}
, because default resolver maps /src/main/resources/static/
to /
url in your case.
查看全文