thymeleaf-spring4-2.1.5.RELEASE で
<select th:field="*{income}">
<option th:each="item : ${income_list}" th:object="${item}" th:value="*{code}">
<span th:text="*{name}"></span>
</option>
</select>
が
ERROR 44072 --- [nio-8091-exec-1] org.thymeleaf.TemplateEngine : [THYMELEAF][http-nio-8091-exec-1] Exception processing template "hoge/index": Error during execution of processor 'org.thymeleaf.spring4.processor.attr.SpringOptionFieldAttrProcessor' (hoge/index)
ERROR 44072 --- [nio-8091-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateProcessingException: Error during execution of processor 'org.thymeleaf.spring4.processor.attr.SpringOptionFieldAttrProcessor' (hoge/index)] with root cause
java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'item' available as request attribute
というエラーになる。前から?
<select th:field="*{income}">
<option th:each="item : ${income_list}" th:value="${item.code}">
<span th:text="${item.name}"></span>
</option>
</select>
と治したら動いた。
ちなみに、select の th:field="*{income}" を外すと動く。
メモで。