I developped an application using spring-boot and thymeleaf as a template in my view I try to use a variable inside a loop but it's not worked. This is a snippet of my code:
<table >
<thead>
<tr>
<th>Type</th>
<th>Résumé</th>
<th>Contenu</th>
</tr>
</thead>
<tbody>
<tr th:each="subTask : ${lstOtherSubTasks}">
<td><img th:src="@{/img/icons/${subTask.issueTypeId}.png}" title="TODO" /> // here the variable ${subTask.issueTypeId} not works
<p th:text="${subTask.issueTypeId}" /> here the value of the variable ${subTask.issueTypeId} is not null I get the good value
</td>
<td th:text="${subTask.resume}"></td>
<td th:text="${subTask.contenu}"></td>
</tr>
</tbody>
</table>
You can't mix expressions and strings like you're doing. This works:
<img th:src="@{${'/img/icons/' + subTask.issueTypeId + '.png'}}" title="TODO" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With