使用 spring/thymeleaf 迭代数据库中的对象时出现问题

问题描述 投票:0回答:1

最近我开始为 Splitwise 创建克隆项目,问题是我无法从数据库中迭代我的用户,即使它们存在并且是在控制台中编写的。

https://github.com/DamianKwc/SplitwiseProject.git

Web 和模板都可以正确打开,但没有对象。这是我第一次来这里,如有任何问题,请见谅。

java mysql spring thymeleaf
1个回答
0
投票

更换

<tr th:each="userList : ${theUsers}">
    <td th:text="${user.id_user}"></td>
    <td th:text="${user.user_name}"></td>
    <td th:text="${user.username}"></td>
</tr>

<tr th:each="theUsers : ${userList}">
    <td th:text="${theUsers.id_user}"></td>
    <td th:text="${theUsers.user_name}"></td>
    <td th:text="${theUsers.login}"></td>
</tr>
© www.soinside.com 2019 - 2024. All rights reserved.