springboot03-thymeleaf详细使用
th:each遍历数组
@RequestMapping("/success")
public String success(Model model, Map<String,Object> map){
map.put("users", Arrays.asList(new User("寇春雷",22),new User("寇雨泽",8),new User("张三",22)));
return "success";
}
<table>
<tr th:each="user: ${users}">
<td th:text="${user.name}"></td>
<!--或者这样写-->
<td>[[${user.age}]]</td>
</tr>
</table>

浙公网安备 33010602011771号