I have a list of 'product' which I want to show as a list of row table using an html template.

The html template looks like:

<tr th:fragment="productTemplate">
    <td th:text="${productName}">product name</td>
    <td th:text="${productprice}>product price</td>
</tr>

Here is what I did:

<table>
  <tr th:each="product : ${products}" th:substituteby="product :: productTemplate" th:with="productName=*{name}, productPrice=*{price}" />
</table>

If I use th:include, there will be tr nested to each tr If I use th:substituteby, substitute has the priority on th:each

I cant find a way to replace my loop items by an other.

Somebody have a solution to do this?

Edit
Report