I want to display data from database in the browser with Spring MVC. Everything is alright, except my Thymeleaf template for each loop. Something is wrong there.
How can I display id data in ID row and name data in Name row iterating through the collection of objects with for each loop?
Source code:
<!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>