thymeleaf實現th:each雙重多重嵌套使用

這文章暫時記錄下,是可以遍歷二次循環

https://blog.csdn.net/a909301740/article/details/100031624

<!DOCTYPE HTML>
<!-- thymeleaf的引用 -->
<html xmlns:th="http://www.thymeleaf.org">
<head>
<!-- 引用的css,js -->
</head>
<!-- 頁面主體 -->
<body>
<ul>
    <!-- 這一級是一級的分類 -->
    <li th:each="cate1:${cateList}"><a th:text="${cate1.cate1Name}"></a>
        <!-- 這是一級下的二級分類列表 -->
        <ul>
            <li th:each="cate2:${cate1.cate2List}"><a th:text="${cate2.cateName}"></a></li>
        </ul>
   </li>
</ul>
</body>
</html>

數據:
thymeleaf實現th:each雙重多重嵌套使用
代碼:

thymeleaf實現th:each雙重多重嵌套使用

結果顯示:
thymeleaf實現th:each雙重多重嵌套使用

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章