avec ressort à feuilles de thym 4-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>
Mais
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
Entraînera l'erreur. D'avant?
<select th:field="*{income}">
<option th:each="item : ${income_list}" th:value="${item.code}">
<span th:text="${item.name}"></span>
</option>
</select>
Cela a fonctionné quand il a été guéri.
En passant, cela fonctionne lorsque vous supprimez th: field = "* {revenu}" de select.
Avec un mémo.
Recommended Posts