title: spring boot- thymeleaf pass data html to controller
body: <p>I try to pass data html to controller but i have a error like that. My GET method is work clearly but POST method doesn't work</p>
  
  <pre><code>java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'post' available as request attribute
      at org.springframework.web.servlet.support.BindStatus.&lt;init&gt;(BindStatus.java:144) ~[spring-webmvc-4.3.4.RELEASE.jar:4.3.4.RELEASE]
      at org.thymeleaf.spring4.util.FieldUtils.getBindStatusFromParsedExpression(FieldUtils.java:401) ~[thymeleaf-spring4-2.1.5.RELEASE.jar:2.1.5.RELEASE]
      at org.thymeleaf.spring4.util.FieldUtils.getBindStatus(FieldUtils.java:328) ~[thymeleaf-spring4-2.1.5.RELEASE.jar:2.1.5.RELEASE]
      at org.thymeleaf.spring4.util.FieldUtils.getBindStatus(FieldUtils.java:294) ~[thymeleaf-spring4-2.1.5.RELEASE.jar:2.1.5.RELEASE]
      at org.thymeleaf.spring4.processor.attr.AbstractSpringFieldAttrProcessor.processAttribute(AbstractSpringFieldAttrProcessor.java:98) ~[thymeleaf-spring4-2.1.5.RELEASE.jar:2.1.5.RELEASE]
      at org.thymeleaf.processor.attr.AbstractAttrProcessor.doProcess(AbstractAttrProcessor.java:87) ~[thymeleaf-2.1.5.RELEASE.jar:2.1.5.RELEASE]
      at org.thymeleaf.processor.AbstractProcessor.process(AbstractProcessor.java:212) ~[thymeleaf-2.1.5.RELEASE.jar:2.1.5.RELEASE]
      at org.thymeleaf.dom.Node.applyNextProcessor(Node.java:1017) ~[thymeleaf-2.1.5.RELEASE.jar:2.1.5.RELEASE]
      at org.thymeleaf.dom.Node.processNode(Node.java:972) ~[thymeleaf-2.1.5.RELEASE.jar:2.1.5.RELEASE]
      at org.thymeleaf.dom.NestableNode.computeNextChild(NestableNode.java:695) ~[thymeleaf-2.1.5.RELEASE.jar:2.1.5.RELEASE]
      at org.thymeleaf.dom.NestableNode.doAdditionalProcess(NestableNode.java:668) ~[thymeleaf-2.1.5.RELEASE.jar:2.1.5.RELEASE]
      at org.thymeleaf.dom.Node.processNode(Node.java:990) ~[thymeleaf-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  </code></pre>
  
  <p>and this is my html form </p>
  
  <pre><code> &lt;form autocomplete="off" action="#" th:action="@{/(${titleId})}"
                th:object="${post}" method="post" class="form-horizontal"
                role="form"&gt;
              &lt;h2&gt;Formu doldur aramıza katıl..&lt;/h2&gt;
              &lt;div class="form-group"&gt;
                  &lt;div class="col-sm-9"&gt;
                      &lt;input type="text" th:field="*{postBody}" placeholder="yorumla"
                             class="form-control" /&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
  
              &lt;div class="form-group"&gt;
                  &lt;div class="col-sm-9"&gt;
                      &lt;button type="submit" class="btn btn-primary btn-block"&gt;Kayıt Ol&lt;/button&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/form&gt;
  </code></pre>
  
  <p>finally my controller method is here</p>
  
  <pre><code>@RequestMapping(value = "/{id}", method = RequestMethod.POST)
      public ModelAndView savePost(@Valid Post post,@PathVariable("id")Long id){
  
          ModelAndView modelAndView =new ModelAndView();
  
          Title title = titleService.getTitleById(id);
  
          Authentication auth = SecurityContextHolder.getContext().getAuthentication();
          User user = userService.findUserByEmail(auth.getName());
  
          Date date = new Date();
  
          Post post1 = new Post();
  
          post1.setPostBody(post.getPostBody());
          post1.setPostDate(date);
          post1.setPostSender(user);
          post1.setPostTitle(title);
  
          postService.savePost(post1);
          modelAndView.addObject("post",post1);
          modelAndView.setViewName("homePage2");
  
          return modelAndView;
      }
  </code></pre>
  
  <p>i can't understand why i have an error.</p>