不允许嵌套块

问题描述 投票:0回答:1
thymeleaf spring-thymeleaf
1个回答
0
投票

在这种特定情况下,您可以将

th:each
分别移动到
table
tr
元素上:

<table th:each="claim:${claimEditor}">
    <tr>
        <td>Number of claim : </td>
        <td th:text="${claim.numberOfClaim}"></td>
    </tr>

    <th:block th:unless="${#lists.isEmpty(claim.record)}">
        <tr th:each="record, iterStat:${claim.record}">
            <td th:rowspan="${record.size()} th:if="${iterStat.first}">Attribute : </td>  
            <td th:text="${record}"></td>
        </tr>
    </th:block>
</table>
© www.soinside.com 2019 - 2024. All rights reserved.