I want to generate a list o products using thymeleaf and bootstrap so that I have three products on a row.
If it weren\'t for the rows, I would have done something l
I would include Apache Commons Collections 4.1 and use ListUtils to partition the list and iterate like this:
<th:block th:with="partitions=${T(org.apache.commons.collections4.ListUtils).partition(products, 3)}">
<div class="row" th:each="partition: ${partitions}">
<div class="col-sm-4" th:each="product: ${partition}">
<div class="product">
<h3 th:text="${product.name}">Product name</h3>
<img th:src="${product.imagePath}" />
</div>
</div>
</div>
</th:block>