Java spring thymeleaf 显示图片

标签 java spring thymeleaf

我想在页面 html 中显示图片,并与数据库中图片的来源和名称相连接 示例:

<tr th:each="e:${PageEtudiants.content}">
<td> <img class="img img-circle" width="50" height="50" `th:src="@{/Upload/(${e.photo})}"/></td>
</tr>`

谢谢

最佳答案

请尝试使用以下代码

<img class="img img-circle" width="50" height="50" th:src="@{'/Upload/'+${e.photo()}}"/>

关于Java spring thymeleaf 显示图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59364168/

相关文章:

mysql - 如何处理应用程序级别的 "Value ' 0000-00-0 0' can not be represented as java.sql.Timestamp"错误?

spring - 使用 Spring MVC 和 Thymeleaf 呈现部分内容

java - 使用 jdbcTemplate 时如何手动处理事务?

java - Springboot Form 转换 HTML -> PDF

java - 如何在 spring mvc 中用 thymeleaf 填充一个简单的表

java - 将计划的 EJB 部署到 Glassfish 服务器时出现问题

java - Spring @Transactional : Rollback information reported but not actually performed

java - 处理Java中某些情况下不希望返回类型的函数返回

java - 如何使用spring data获取mongodb中最大聚合函数对应的值

java - Spring Boot junit 测试安全应用程序