title: Spring + Hibernate Validation error
body: <p>I am trying to implement Hibernate+Spring Validation to my application,but there is one issue, it won't display error message on page after I submit faulty data. Here is code:</p>
  
  <pre><code>import javax.validation.constraints.NotNull;
  import javax.validation.constraints.Size;
  
  
  public class StudentVO {
  
  private int studentID;
  private String userName;
  
  @NotNull
  @Size(min=2, max=45, message="Your Name should be between 2 - 45 characters.")
  private String firstName;
  
  private String middleName;
  
  @NotNull
  @Size(min=2, max=45, message="Your Surname should be between 2 - 45 characters.")
  private String lastName;
  </code></pre>
  
  <p>JSP</p>
  
  <pre><code>&lt;form:form id="myform" modelAttribute="student" method="post"  class="form-horizontal" action="/register/registerStudent"&gt;
  &lt;div class="form-group"&gt;
  &lt;label for="firstname" class="col-sm-3 control-label"&gt;First Name&lt;/label&gt;
      &lt;div class="col-sm-6"&gt;
          &lt;form:input type="text" class="form-control float_left" id="firstname" path="firstName" placeholder="First Name" /&gt;
          &lt;form:errors path="firstName"&gt;&lt;/form:errors&gt;
        &lt;/div&gt;
   &lt;/div&gt;
    &lt;div class="form-group"&gt;
    &lt;label for="middlename" class="col-sm-3 control-label" id="md"&gt;Middle Name&lt;/label&gt;
        &lt;div class="col-sm-6"&gt;
            &lt;form:input type="text" class="form-control" id="middlename" path="middleName" placeholder="Middle Name" /&gt;
        &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="form-group"&gt;
   &lt;label for="lastname" class="col-sm-3 control-label"&gt;Last Name&lt;/label&gt;
       &lt;div class=" col-sm-6"&gt;
           &lt;form:input type="text" class="form-control float_left"   id="lastname" path="lastName" placeholder="Last Name" required="true" /&gt;
            &lt;form:errors path="lastName"&gt;&lt;/form:errors&gt;
       &lt;/div&gt;
  </code></pre>
  
  <p>
      </p>
  
  <p>Controller</p>
  
  <pre><code>@RequestMapping(value = { "/register/registerStudent" }, method = { RequestMethod.GET, RequestMethod.POST })
  public String registerSubmit(@Valid StudentVO student, BindingResult result, Model model, HttpServletRequest request,
          @RequestParam String action, @RequestParam(value = "parentID", required = false) String parentID,
          @RequestParam(value = "studentID", required = false) String studentID,
          RedirectAttributes redirectAttributes) {
      if(result.hasErrors()){
          model.addAttribute("student", student);
          List&lt;Map&lt;String, String&gt;&gt; age = lookupService.getFields("age");
          model.addAttribute("age", age);
          return "studentSignup";
      }
  </code></pre>
  
  <p>Thanks for help!</p>