【发布时间】:2020-09-01 07:49:56
【问题描述】:
嗯,我希望我的图像在 Front(html) 中显示表格数据。 我使用 model.addAttributes 来传递玩家信息。 我原来的 imgfile 在路径中:/img/
这是我的问题代码如下:
<tbody>
<tr th:each="players : ${players}">
<td><img src="/img/ + ${players.id} + '_' + ${players.name} + '.png'" width="120"/></td>
我的图像命名总是用“id+name”.png 定义的。 我不知道如何将它与 img src 路径结合起来。 我想要的解决方案是像下面这样工作:
<td><img src="/img/1_pogba.png" width="120"/></td>
【问题讨论】:
-
你试过 src=`/img/${players.id}_${players.name}.png`(带反引号)吗?
标签: spring spring-boot spring-mvc thymeleaf