title: Bad Request binding objects in Spring Framework
body: <p>We are trying to do a three level binding:</p>
  
  <blockquote>
    <p>GrandFather -> (has many) Parent -> (has many) Child</p>
  </blockquote>
  
  <p>Our GrandFather and parents are saved in database then they have id's autogenerated. But our Child's are new in some cases and they haven't id values.</p>
  
  <p>When we send this information by ajax to our server (Weblogic), we are doing a binding to the data using:</p>
  
  <pre><code>@RequestMapping(value = "/blablabla/update", method = RequestMethod.POST)
  public String updateProducts(@ModelAttribute GrandFather grandpa, BindingResult result, Model model) {
  
  ...
  }
  </code></pre>
  
  <p>The result is that you see a Bad Request error in your browser (using Firebug). We only see that the child haven't ids, the others values are perfect. You can't see any in server side, any code of your method is executed.</p>
  
  <p>That wouldn't be a problem, but it's. Any ideas about what's happen?</p>
  
  <p>Thanks.</p>
  
  <p>Note. We are using Spring framework; Spring MVC; Weblogic server and other controllers and bindings are working.</p>
  
  <p><strong>Update</strong>:</p>
  
  <p>The html code used:  </p>
  
  <pre><code>&lt;c:forEach items="${question.answers}" var="answer" varStatus="statusAnswer"&gt; 
  ... 
  &lt;c:forEach items="${answer.ratings}" var="rating" varStatus="statusRating"&gt; 
  ... 
  &lt;input type="hidden" name="questions[${statusQuestion.index}].id" value="${question.id}"/&gt; 
  &lt;input type="hidden" name="questions[${statusQuestion.index}].respuestas[${statusQuestion.index}].ratings[${statusRating.index}].id" value="${valoracion.id}" /&gt; 
  ... 
  &lt;/c:forEach&gt; 
  ... 
  &lt;/c:forEach&gt;
  </code></pre>
  
  <p>The how to send it's difficult to paste here have a lot of javascript to fill some values of the objects.</p>