nested (double) loop with thymeleaf

后端 未结 1 710
情歌与酒
情歌与酒 2021-01-19 23:52

I\'ve tried searching for existing answers, but I could not find them.

I\'d like to access an ArrayList from an object within an ArrayList, so:

Basically t

相关标签:
1条回答
  • 2021-01-20 00:35

    I'm not sure but I don't think you can access public non-static getters like you do (assuming getName() is marked as public).

    You should try:

    <table>
        <span th:each="word : ${glossary.words}">
            <td>
                <tr th:each="relatedWord: ${word.relatedWords}">
                    <p th:text="${relatedWord.name}"></p>
                </tr>
            <td>
        </span>
    </table>
    

    One note: the above code is absolutely not valid XHTML (span directly inside table, tr directly inside td).

    0 讨论(0)
提交回复
热议问题