[英]image is not showing in html thymeleaf springboot
我正在使用百里香和springboot
I am not able to view any images in my HTML file. I have tried all different ways of doing
the same in thymeleaf but no luck.
Here is my project folder structure
🗁 src
└─── 🗁 main
└─── 🗁 resources
├─── 🗁 templates
├─── 🗁 css
└─── 🗁 images
在 HTML 文件中,我使用:
<img src="/src/main/resources/static/image.png" alt="images">
在嘗試了很多事情之后我終於得到了答案
Spring Boot's default configuration come that, your images (and other static
content), need to be in src/main/resources/static. For example, to serve content
from /images put the files in src/main/resources/static/images
And i used it
<img th:src="@{/images/image.png}" alt="image" width="300" height="200">
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.