java - Spring-Boot Thymeleaf 以 html 格式加载图像,列表不显示
问题描述
我正在使用 Spring-Boot Thymeleaf 制作带有上传菜单(图像)的小应用程序,我的上传菜单正在工作,所以列表菜单上传,但问题是当我尝试将我的图像从 netbeans 中的静态文件夹显示到网页时,我的文件名是出现,但我的形象没有。应该怎么样?
我从之前创建的列表菜单中获取文件数据图像。
//这是来自我的 list.html:
<table border='1' width='50%' height='100%'>
<tr th:each="files: ${fileName}">
<td th:text="${files}"/>
<td><img src="../static/img/ "width="100"
th:src="@{img/' + files + '}"/></td>
</tr>
我希望网页上的输出是我的文件名(来自图像)和图像显示。
解决方案
你的 th:src 接缝是错误的。它应该是
<img th:src="@{'/img/'+ ${files}}">
推荐阅读
- excel - 复制单元格范围并使用偏移按顺序粘贴
- java - 从 ZipInputStream 复制条目
- django - Django模型设计问题与关系
- java - Java - 使用 mkdir() 创建新目录?
- php - loop csv column values and concatenate values to new column in php
- java - Spring Auto REST Docs - don't work properly
- datatables - Does YADCF multi_select work with custom_select initialized via initSelectPluginCustomTriggers
- react-native - React Native font scale
- git - How to stop tracking the content of a directory in git?
- bigdata - Pentaho Dashboard Performance