BullCyclone
BullCyclone

Reputation: 3

Thymeleaf: th:each error

I want to do this in thymeleaf template, but I got error

<tr th:each="user : ${userList}" th:id="${user.id}}">
    <td th:text="${user.email}"></td>
    <td th:text="${user.name}"></td>
    <td th:text="${user.gender}"></td>
    <td th:text="${user.level}"></td>
</tr>

error

Could not parse as expression: "${user.id}}"

Please tell me how to deal with this problem :)

Thanks,

Upvotes: 0

Views: 1015

Answers (1)

Faraj Farook
Faraj Farook

Reputation: 14915

You have used } twice in the error line. Try this.

<tr th:each="user : ${userList}" th:id="${user.id}">
    <td th:text="${user.email}"></td>
    <td th:text="${user.name}"></td>
    <td th:text="${user.gender}"></td>
    <td th:text="${user.level}"></td>
</tr>

Upvotes: 2

Related Questions