title: How to display error message from Spring validator?
body: <p>I've been spending good few hours on this, so it's time to ask.</p>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>@RequestMapping(value="/articleHeaderEdit/{articleId}", method=RequestMethod.POST)
  public ModelAndView submitHeader(@PathVariable Integer articleId, @ModelAttribute("screenObject") ArticleHeaderEditScreenObject articleHeaderEditScreenObject, @ModelAttribute("article") Article article, BindingResult bindingResult, Model model, Locale locale) throws Exception {
      validator.validate(articleHeaderEditScreenObject, bindingResult);
  
      ModelAndView modelAndView=new ModelAndView();
  
      if(bindingResult.hasErrors()) {
          initializeScreenObject(articleHeaderEditScreenObject, article, locale);
          modelAndView.setViewName(WebView.ARTICLE_HEADER_EDIT_PAGE.getViewName());
  
      } else {
          modelAndView.setViewName("redirect:/article/" + articleId);
      }
  
      return modelAndView;
  }   
  </code></pre>
  
  <p><strong>Validator</strong></p>
  
  <pre><code>@Component
  public class ArticleHeaderEditScreenObjectValidator implements Validator {
      @Override
      public boolean supports(Class&lt;?&gt; clazz) {
          return ArticleHeaderEditScreenObject.class.isAssignableFrom(clazz); 
  }
  
  @Override
  public void validate(Object validatedObject, Errors errors) {
      ValidationUtils.rejectIfEmptyOrWhitespace(errors, "title", "required.title", "Title is required.");
  }
  </code></pre>
  
  <p><strong>View</strong> (only the relevant html)</p>
  
  <pre><code>&lt;form:form modelAttribute="screenObject" action="${screenObject.getFormAction()}"&gt;
  
      &lt;form:errors path="*" /&gt;
  
      &lt;form:errors /&gt;
  
      &lt;form:input path="title" /&gt;
      &lt;form:errors path="title" /&gt;
  </code></pre>
  
  <p>The error is there. I get the right view and I double checked by debugging. None of the three errors tags works, though. When I submit the page, it keeps newly entered data, so model works fine. </p>
  
  <p>I see a lot of people struggling with this. Generally, it's the fact that model attribute has a different name in the form and in the controller but in this case they are the same. Any idea what else is missing?</p>