title: Spring MVC @Valid not working when form is binded to a list
body: <p>I am trying to do form validations on a Spring MVC form binded to a list of objects. The validations are not working. Please let me know if I am missing something</p>
  
  <pre><code>@Component
  public class Customer{
     @NotEmpty private int custId;
     @NotEmpty private List&lt;Order&gt; orders;
     //Getters &amp; Setters...
  }
  
  @Component
  public class Order{
     @NotEmpty private String id;
     @NotEmpty private String orderName;
     //Getters &amp; Setters...
  }
  
  //JSP - custFormBean is set as a model attribute
  
  &lt;form:form method="post" action="/submitOrder.htm" modelAttribute="custFormBean"&gt;
      &lt;table class="activity" width="600px" bgcolor="#FCF4DE"&gt;
          &lt;c:forEach items="${custForm.orders}" var="order" varStatus="status"&gt;
              &lt;tr&gt;
                  &lt;td&gt;
                      &lt;c:out value="${order.id}" /&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td&gt;                    
                      &lt;form:password path="orders[${status.index}].orderName" name="name" /&gt;
                  &lt;/td&gt;
                  &lt;td&gt;&lt;form:errors path="orders[${status.index}].orderName" cssClass="errorMessage" /&gt;&lt;/td&gt; 
              &lt;/tr&gt;
          &lt;/c:forEach&gt;
          &lt;tr&gt;&lt;/tr&gt;
          &lt;tr&gt;
              &lt;td align="center" colspan="2"&gt;
                  &lt;input type="submit" id="orderSubmit" class="formButton" value="OK" /&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/form:form&gt;
  
  //Controller
  @Controller
  @SessionAttributes("custFormBean")
  public class CustomerController {
  
      @RequestMapping(value = "/order.htm", method=RequestMethod.GET)
      public String getOrder(ModelMap model, HttpServletRequest request) {
          nextPage = "order"
          try {
              Customer custBean = custService.getCustOrders(...);
              model.addAttribute("custFormBean", custBean); 
          } catch (ServiceException e) {
              log.error("ServiceException when calling getChallengeQuestionLists", e);
          }       
          return nextPage;
      }
  
     @RequestMapping(value = "/submitOrder.htm", method=RequestMethod.POST)
     public String submitOrder(@Valid @ModelAttribute("custFormBean") Customer custBean, BindingResult result, Model model, HttpServletRequest request){
          String nextPage = "success";
      if(result.hasErrors()) {        
  //This is not working - The custBean is populated with the values entered in the form but if I leave the fields empty the validation is not kicking in.
         log.debug("Validation errors...");
         nextPage = "error";
      }   
      return nextPage;
     }
  }
  </code></pre>
  
  <p>Please let me know if I am missing something</p>