thymeleaf如何遍歷數據 each循環的使用


首先在html開始標簽中引入一個屬性

1 xmlns:th="http://www.thymeleaf.org"

遍歷數據示例

1 <tbody>
2     <tr th:each="user:${users}">
3     <td th:text="${user.name}"></td>
4     <td th:text="${user.email}"></td>
5     <td><a th:href="@{/edit/{id}(id=${user.id})}">修改</a></td>
6     <td><a th:href="@{/delete/{id}(id=${user.id})}">刪除</a></td>
7      </tr>
8 </tbody>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM