title: Spring Web Flow Model Validation won't work properly
body: <p>I am currently working on a web application, which uses Spring Web Flow for some forms. I want to use the automatic validation powered by spring, so therefore I have</p>
  
  <ul>
  <li>instantiated a 'validator' bean in my spring web flow configuration file (Class LocalValidatorFactoryBean).</li>
  <li>Created a method with the signature validate{VieStateId}(ValidationContext context) inside my model (which is associated to the view state in the flow configuration as a model).</li>
  <li>Used spring:bind tag from the spring tag library to show error message if it appears.</li>
  </ul>
  
  <p>So far my web flow view page won't go further when Validator is associated, so I can see that it is going to my validate method. The problem is that I can't get my error message to show. When testing ${status.error} inside my bind tag, then it returns false, always.</p>
  
  <p>My Validate method inside my Model Class.</p>
  
  <pre><code>public void validateEnterMovieDetails(ValidationContext context) {
      if (context.getUserEvent().equals("next")) {
          MessageContext messages = context.getMessageContext();
  
          if (this.title.isEmpty() || this.title == null) {
              messages.addMessage(new MessageBuilder().error().source("title").code("validation.movie.title.required").build())
          }
      }
  }
  </code></pre>
  
  <p>My JSP file</p>
  
  <pre><code>&lt;form:form modelAttribute="movie" action="${flowExecutionUrl}"&gt;
      &lt;spring:bind path="title"&gt;
          &lt;c:if test="${status.error}"&gt;
              &lt;form:errors path="title" /&gt;
          &lt;/c:if&gt;
      &lt;/spring:bind&gt;
  &lt;/form:form&gt;
  </code></pre>
  
  <p>My problem is that it seems that my validation is working, since when I apply this validate method, then I can't go to the next view in the flow, though My bind can't seem to find any errors at all.</p>
  
  <p>So I hope anyone please can help me solve this problem, since I have tried search the web for answers, and nothing seemed to help. You can see the full source code to my project at my GitHub account - <a href="https://github.com/martin-rohwedder/movstream" rel="nofollow">https://github.com/martin-rohwedder/movstream</a></p>