Spring Boot / View / Thymeleaf / テンプレート / 制御構文

Spring Boot / View / Thymeleaf / テンプレート / 制御構文

if

真偽値による分岐処理はこうなる

<th:block th:if="${hoge}">
    aaa
</th:block>

for 決められた回数ループ

<th:block th:each="i : ${#numbers.sequence(0, 9)}">
    [[${i}]]
</th:block>

この場合なら 0 から 9 までループ。つまり10周ループ

for コレクションのループ

<th:block th:each="hoge : ${hogeList}" >
    [[${hoge.toString()}]]
</th:block>
java/spring/spring_boot/view/thymeleaf/template/control_statements/start.txt · 最終更新: 2021-06-25 13:26 by ore