with 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>
But
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
Will result in the error. From before?
<select th:field="*{income}">
<option th:each="item : ${income_list}" th:value="${item.code}">
<span th:text="${item.name}"></span>
</option>
</select>
It worked when he was cured.
By the way, it works when you remove th: field = "* {income}" of select.
With a memo.
Recommended Posts