I have a DTO with multiple objects in it, it is basically an ArrayList
sent by the Spring Boot controller to the Thymeleaf template.
This list of objects needs to be sent back to the controller, but i am doing something wrong
This is my template code, i have made it much more short for readability because the real one is huge, i think this includes the important part:
<form action="#" method="post" th:action="@{/v1/endpoint'}" th:object="${listOfObjects}">
<th:block th:each="object,i : ${listOfObjects}">
<input th:field="*{listOfObjects[__${i.index}__].property}"
th:value="*{listOfObjects[__${i.index}__].property}" type="hidden"/>
<!-- more fields -->
</th:block>
<input type="submit" value="submit">
</form>
But while rendering the page i get:
Caused by: org.springframework.expression.spel.SpelEvaluationException: EL1008E: Property or field 'listOfObjects' cannot be found on object of type 'java.util.ArrayList' - maybe not public or not valid?