I have a user class with a List of Meals inside this class. I'm wondering, how to iterate through all users and meals inside each user to get an effect like this below:
User class:
@Entity
@Table(name = "users")
public class User {
private int id;
private String username;
private String password;
private int age;
private String email;
private Gender gender;
private List<Meal> meals;
// ...
}
I now, how to iterate through users, but can't imagine how
<body>
<table class="table">
<thead>
<tr>
<th>Username</th>
</tr>
</thead>
<tbody>
<tr th:each="user : ${users}">
<td th:text="${user.getUsername()}"></td>
</tr>
</tbody>
</table>
</body>