title: Spring form error does not display: Controller, command or template issue?
body: <p>I am trying to create a Spring MVC webapp, and I want to add some Validation to my forms, with Thymeleaf.
  The app is running but the Validation doesn't seem to work, as nothing is displayed.</p>
  <p>Here is my Command class:</p>
  <pre><code>public class WatchlistItem {
  
  private Integer id;
  
  @NotBlank(message=&quot;Please, enter all the fields&quot;)
  private String title;
  
  private String rating;
  
  private String priority;
  
  @Size(max=50, message=&quot;Comment should be maximum 50 characters&quot;)
  private String comment;
  </code></pre>
  <p>My Controller:</p>
  <pre><code>@Controller
  public class WatchlistController {
  
  private final List&lt;WatchlistItem&gt; watchlistItems = new ArrayList&lt;&gt;();
  private static int index = 1;
  
  @PostMapping(&quot;/watchlistItemForm&quot;)
  public ModelAndView submitWatchlistItemForm(@Valid WatchlistItem watchlistItem, BindingResult bindingResult) {
  
      if (bindingResult.hasErrors()) {
          return new ModelAndView(&quot;watchlistItemForm&quot;);
      }
  
      WatchlistItem existingItem = findWatchlistItemById(watchlistItem.getId());
  
      if (existingItem == null) {
          watchlistItem.setId(index++);
          watchlistItems.add(watchlistItem);
      } else {
          existingItem.setComment(watchlistItem.getComment());
          existingItem.setPriority(watchlistItem.getPriority());
          existingItem.setRating(watchlistItem.getRating());
          existingItem.setTitle(watchlistItem.getTitle());
      }
  
      RedirectView redirect = new RedirectView();
      redirect.setUrl(&quot;/watchlist&quot;);
  
      return new ModelAndView(redirect);
  }
  </code></pre>
  <p>And finally the template of my .html:</p>
  <pre><code>   &lt;form action=&quot;#&quot; method=&quot;post&quot; th:action=&quot;@{/watchlistItemForm}&quot; th:object=&quot;${watchlistItem}&quot;&gt;
    &lt;h2 class = &quot;mt-4&quot;&gt;Submit an item&lt;/h2&gt;
    &lt;hr/&gt;
    &lt;div class = &quot;form-group row &quot;&gt;
       &lt;label for = &quot;title&quot; class = &quot;col-sm-2 col-form-label&quot;&gt;Title&lt;/label&gt;
       &lt;div class = &quot;col-sm-4&quot;&gt;
          &lt;input th:field=&quot;*{title}&quot; type = &quot;text&quot; class = &quot;form-control&quot; placeholder = &quot;Mandatory&quot;&gt;
       &lt;/div&gt;
       &lt;div class=&quot;col-sm-4&quot;&gt;
          &lt;span class=&quot;text-danger&quot; th:errors=&quot;*{title}&quot;&gt; &lt;/span&gt;
       &lt;/div&gt;
    &lt;/div&gt;
  </code></pre>
  <p>I already had a look on the following post: <a href="https://stackoverflow.com/questions/26013906/spring-error-form-not-displayed">Spring Error form not displayed</a>, but nothing worked.
  The issue is that I have no idea where the problem comes from, the controller, the command or the html page.</p>