This is my code fragment:
<th:block th:each="d : ${items}">
<!--<tr>-->
<td th:text="${d.productname}"></td>
<td th:text="${d.quantity}"></td>
<td th:text="${d.price}"></td>
<!--</tr>-->
</th:block>
items is an ArrayList.
I can get data if the tr doesn't exist (as you can see I commented it in the code).
If I put them back, my th:text gets null values.
I also tried tr th:each but it didn't help.
How can I solve this problem? Thank you.
I am using thymeleaf-3.0.0 ,It worked for me.
<table>
<tr th:each="d : ${items}" >
<td th:text="${d.productname}"></td>
<td th:text="${d.quantity}"></td>
<td th:text="${d.price}"></td>
</tr>
</table>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With