I am trying to iterate over list with keeping track of iteration and I want to place iteration index into array index of that list:
What I tried:
<tr th:each="experience, iter : *{experiences}">
<td>Experience name:</td>
<td><input type="text" th:field="*{experiences[iter.index]}" value="${experience.name}">
</tr>
Here I get NumberFormatException. So I tried to use $, because I think that iter is a variable:
<tr th:each="experience, iter : *{experiences}">
<td>Experience name:</td>
<td><input type="text" th:field="*{experiences[${iter.index}]}" value="${experience.name}">
</tr>
Here, ${iter.index} is not evaluated, so I get error that ${iter.index} is not a number (again NumberFormatException).