title: Thymeleaf Neither BindingResult nor plain target object for bean name 'person' available as request attribute
body: <p>From what I can tell this is set up correctly but I am getting the following error:</p>
  
  <pre><code>java.lang.IllegalStateException: Neither BindingResult nor plain target 
  object for bean name 'person' available as request attribute
  </code></pre>
  
  <p>Form</p>
  
  <pre><code>&lt;form action="#" th:action="@{/person}" th:object="${person}" method="post" th:required="required"&gt;
      &lt;input type="text" th:field="*{subject}" class="contact col-md-6" placeholder="Name *" th:required="required"/&gt;
      &lt;input type="text" th:field="*{name}" class="contact col-md-6" placeholder="Name *" th:required="required"/&gt;
      &lt;input type="text" th:field="*{lastName}" class="contact col-md-6" placeholder="Name *" th:required="required"/&gt;
      &lt;input type="email" th:field="*{email}" class="contact noMarr col-md-6" placeholder="E-mail address *" th:required="required"/&gt;
      &lt;textarea name="comment" class="contact col-md-12" th:field="*{message}" placeholder="Message *"&gt;&lt;/textarea&gt;
      &lt;input type="submit" id="submit" class="contact submit" value="Send message"/&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Person.java</p>
  
  <pre><code>public class Person {
  
      private int id;
      private String name;
      private String lastName;
      private String email;
      private String subject;
      private String message;
  
      ....
  }
  </code></pre>
  
  <p>Controller</p>
  
  <pre><code>@Controller
  public class ApplicationController {
  
      @RequestMapping(value = "/", method = RequestMethod.GET)
      public String indexPage() {
          return "index";
      }
  
      @RequestMapping(value="/person", method=RequestMethod.GET)
      public String contactForm(Model model) {
          model.addAttribute("person", new Person());
          return "index";
      }
  
      @RequestMapping(value="/person", method=RequestMethod.POST)
      public String contactSubmit(@ModelAttribute Person person, Model model) {
          model.addAttribute("person", person);
          return "result";
      }
  }
  </code></pre>
  
  <p>I looked at <a href="https://spring.io/guides/gs/handling-form-submission/" rel="nofollow noreferrer">Spring-boot and Thmeleaf setup</a> and it looks like my setup is identical.</p>
  
  <p>--------------------- Update 1 -----------------------</p>
  
  <p>I have changed my post method to include BindingResult with no success.</p>
  
  <pre><code>@RequestMapping(value="/person", method=RequestMethod.POST)
  public String contactSubmit(@Valid @ModelAttribute Person person, BindingResult bindingResult, Model model) {
  
      if(bindingResult.hasErrors()){
          System.out.println("There was a error "+bindingResult);
          System.out.println("Person is: "+ person.getEmail());
          return "index";
      }
  
      model.addAttribute("person", person);
      return "result";
  }
  </code></pre>