Version of Thymeleaf (and any involved extensions) you are using.
spring-boot-starter-thymeleaf - 3.2.0
spring-boot-starter-thymeleaf - 3.2.0
Detailed steps to reproduce your issue.
Using technicalDescription which is populated by th:each results in an exception (see below) if used with th:field
2023-12-27T13:51:46.378+01:00 ERROR 8140 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: org.thymeleaf.exceptions.TemplateProcessingException: Error during execution of processor 'org.thymeleaf.spring6.processor.SpringTextareaFieldTagProcessor' (template: "editReport" - line 35, col 91)] with root cause
java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'reportVuln' available as request attribute
at org.springframework.web.servlet.support.BindStatus.(BindStatus.java:153) ~[spring-webmvc-6.1.1.jar:6.1.1]
at org.springframework.web.servlet.support.RequestContext.getBindStatus(RequestContext.java:926) ~[spring-webmvc-6.1.1.jar:6.1.1]
at org.thymeleaf.spring6.context.webmvc.SpringWebMvcThymeleafRequestContext.getBindStatus(SpringWebMvcThymeleafRequestContext.java:232) ~[thymeleaf-spring6-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.thymeleaf.spring6.util.FieldUtils.getBindStatusFromParsedExpression(FieldUtils.java:306) ~[thymeleaf-spring6-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.thymeleaf.spring6.util.FieldUtils.getBindStatus(FieldUtils.java:258) ~[thymeleaf-spring6-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.thymeleaf.spring6.util.FieldUtils.getBindStatus(FieldUtils.java:227) ~[thymeleaf-spring6-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.thymeleaf.spring6.processor.AbstractSpringFieldTagProcessor.doProcess(AbstractSpringFieldTagProcessor.java:174) ~[thymeleaf-spring6-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.thymeleaf.processor.element.AbstractAttributeTagProcessor.doProcess(AbstractAttributeTagProcessor.java:74) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.thymeleaf.processor.element.AbstractElementTagProcessor.process(AbstractElementTagProcessor.java:95) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.thymeleaf.util.ProcessorConfigurationUtils$ElementTagProcessorWrapper.process(ProcessorConfigurationUtils.java:633) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
Interestingly enough, if one doesn't use th:field but th:value, the exception is not thrown and the textarea will have an attribute called "value" (however to set the value of the textarea, I need to use th:field).
Here the according java part:
```java
@GetMapping("/editReport")
public ModelAndView editReport(@RequestParam(value = "id") int id) {
ModelAndView edit = new ModelAndView();
edit.setViewName("editReport");
Report report= db.getReports().stream().filter(r -> r.getId()==id).findFirst().orElseThrow();
edit.addObject("report", report);
edit.addObject("vulnerabilities",db.getVulns());
return edit;
}
Any possible workarounds you may have found.
See th:field using the index to access the object, this works fine.
Version of Thymeleaf (and any involved extensions) you are using. spring-boot-starter-thymeleaf - 3.2.0 spring-boot-starter-thymeleaf - 3.2.0
Detailed steps to reproduce your issue. Using technicalDescription which is populated by th:each results in an exception (see below) if used with th:field
Exception:
java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'reportVuln' available as request attribute at org.springframework.web.servlet.support.BindStatus.(BindStatus.java:153) ~[spring-webmvc-6.1.1.jar:6.1.1]
at org.springframework.web.servlet.support.RequestContext.getBindStatus(RequestContext.java:926) ~[spring-webmvc-6.1.1.jar:6.1.1]
at org.thymeleaf.spring6.context.webmvc.SpringWebMvcThymeleafRequestContext.getBindStatus(SpringWebMvcThymeleafRequestContext.java:232) ~[thymeleaf-spring6-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.thymeleaf.spring6.util.FieldUtils.getBindStatusFromParsedExpression(FieldUtils.java:306) ~[thymeleaf-spring6-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.thymeleaf.spring6.util.FieldUtils.getBindStatus(FieldUtils.java:258) ~[thymeleaf-spring6-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.thymeleaf.spring6.util.FieldUtils.getBindStatus(FieldUtils.java:227) ~[thymeleaf-spring6-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.thymeleaf.spring6.processor.AbstractSpringFieldTagProcessor.doProcess(AbstractSpringFieldTagProcessor.java:174) ~[thymeleaf-spring6-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.thymeleaf.processor.element.AbstractAttributeTagProcessor.doProcess(AbstractAttributeTagProcessor.java:74) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.thymeleaf.processor.element.AbstractElementTagProcessor.process(AbstractElementTagProcessor.java:95) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.thymeleaf.util.ProcessorConfigurationUtils$ElementTagProcessorWrapper.process(ProcessorConfigurationUtils.java:633) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]