在Thomleaf模板中使用src图像内部的变量

Ami*_*tim 3 thymeleaf spring-boot

我在我的视图中使用spring-boot和thymeleaf作为模板开发了一个应用程序我尝试在循环中使用变量但是它没有用.这是我的代码片段:

<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>
Run Code Online (Sandbox Code Playgroud)

Met*_*ids 17

你不能像你一样混合表达式和字符串.这有效:

 <img th:src="@{${'/img/icons/' + subTask.issueTypeId + '.png'}}" title="TODO" />
Run Code Online (Sandbox Code Playgroud)