我想用Spring MVC在浏览器中显示数据库中的数据.一切都没问题,除了每个循环的Thymeleaf模板.那里出了点问题.
如何id在ID行中显示数据,name在Name行中显示数据,迭代每个循环的对象集合?
源代码:
<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>Getting Started: Serving Web Content</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<table border="1">
<tr style="font-size: 13">
<td>ID</td>
<td>Name</td>
</tr>
<tr th:each="count : ${id}">
<td><p th:text="${count}" /></td>
<td><p th:text="${name}" /></td>
</tr>
</table>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)