java - can't reference iteration variable in Thymeleaf -


i try iterate list of items using th:each,

<div class="row" th:each="item : *{items}">   <input type="text" th:field="item.name"/> </div> 

it works if access iteration variable using th:text, throws

java.lang.illegalstateexception: neither bindingresult nor plain target object bean name 'item' available request attribute

when use th:field access it, did wrong?

something work:

<div class="row" th:each="item, stat : *{items}">   <input type="text" th:field="*{items[__${stat.index}__].name}"/> </div> 

take peek here more info: http://forum.thymeleaf.org/i-have-problem-in-binding-the-list-of-objects-contained-inside-a-object-on-the-form-using-thymeleaf-td3525038.html


Comments