一、前端页面
1、前端页面1
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>循环遍历list集合</title>
</head>
<body>
<!--
user:变量
userStat:将要遍历的对象
userStat可以省略,默认为变量加Stat,例如:user + Stat = userStat
-->
<div th:each="user, userStat:${userList}">
<span th:text="${user.id}"></span><br>
<span th:text="${user.name}"></span><br>
<span th:text="${user.phone}"></span><br>
<span th:text="${user.address}"></span><br>
</div>
</body>
</html>
2、前端页面2
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>循环遍历map集合</title>
</head>
<body>
<!--
map:变量
mapStat:将要遍历的对象
mapStat可以省略,默认为变量加Stat,例如:map + Stat = mapStat
-->
<div th:each="map, mapStat:${userMap}">
<span th:text="${mapStat.index}"></span><br>
<span th:text="${mapStat.count}"></span><br>
<