1. @GetMapping("/dynamic_table")
    2. public String dynamic_table(Model model){
    3. //表格内容的遍历
    4. List<User> users = Arrays.asList(new User("zhangsan", "123456"),
    5. new User("lisi", "123444"),
    6. new User("haha", "aaaaa"),
    7. new User("hehe ", "aaddd"));
    8. model.addAttribute("users",users);
    9. return "table/dynamic_table";
    10. }
    1. <table class="display table table-bordered" id="hidden-table-info">
    2. <thead>
    3. <tr>
    4. <th>#</th>
    5. <th>用户名</th>
    6. <th>密码</th>
    7. </tr>
    8. </thead>
    9. <tbody>
    10. <tr class="gradeX" th:each="user,stats:${users}">
    11. <td th:text="${stats.count}">Trident</td>
    12. <td th:text="${user.userName}">Internet</td>
    13. <td >[[${user.password}]]</td>
    14. </tr>
    15. </tbody>
    16. </table>