title: Thymeleaf Could not bind form errors using expression "*"
body: <p>I use Spring-boot and Thymeleaf template engine and I try use <code>th:classappend</code> attribute for adding optional "has-error" class for &lt; div > html tag using <code>#fields.hasErrors('*')</code> expression</p>
  
  <pre><code>&lt;form method="POST" action="/registration" class="form-signin"&gt;
          &lt;h2 class="form-signin-heading"&gt;Create your account&lt;/h2&gt;
  
          &lt;div class="form-group" th:classappend="${#fields.hasErrors('*')} ? 'has-error' : ''"&gt;
              &lt;input name="username" type="text" class="form-control" placeholder="Username" autofocus="true"/&gt;
              &lt;p class="alert alert-danger" th:if="${#fields.hasErrors('username')}" th:errors="*{username}"&gt;&lt;/p&gt;
          &lt;/div&gt;
  
          &lt;div class="form-group" th:classappend="${#fields.hasErrors('*')} ? 'has-error' : ''"&gt;
              &lt;input name="password" type="text" class="form-control" placeholder="Password" autofocus="true"/&gt;
              &lt;p class="alert alert-danger" th:if="${#fields.hasErrors('password')}" th:errors="*{password}"&gt;&lt;/p&gt;
          &lt;/div&gt;
  
          &lt;div class="form-group" th:classappend="${#fields.hasErrors('*')} ? 'has-error' : ''"&gt;
              &lt;input name="passwordConfirm" type="text" class="form-control" placeholder="Confirm your password" autofocus="true"/&gt;
              &lt;p class="alert alert-danger" th:if="${#fields.hasErrors('passwordConfirm')}" th:errors="*{passwordConfirm}"&gt;&lt;/p&gt;
          &lt;/div&gt;
  
          &lt;button class="btn btn-lg btn-primary btn-block" type="submit"&gt;Submit&lt;/button&gt;
  
  
      &lt;/form&gt;
  </code></pre>
  
  <p>but I have this error</p>
  
  <blockquote>
    <p>Could not bind form errors using expression "*". Please check this
    expression is being executed inside the adequate context (e.g. a
     with a th:object attribute)</p>
  </blockquote>
  
  <p>my controller methods</p>
  
  <pre><code>@RequestMapping(value = "/registration", method = RequestMethod.GET)
      public String registration(Model model) {
          model.addAttribute("userForm", new User());
  
          return "registration";
      }
  
      @RequestMapping(value = "/registration", method = RequestMethod.POST)
      public String registration(@ModelAttribute("userForm") User userForm, BindingResult bindingResult, Model model) {
          userValidator.validate(userForm, bindingResult);
  
          if (bindingResult.hasErrors()) {
              return "registration";
          }
  
          userService.save(userForm);
  
          securityService.autologin(userForm.getUsername(), userForm.getPasswordConfirm());
  
          return "redirect:/welcome";
      }
  </code></pre>
  
  <p>what am I doing wrong?</p>