title: Spring MVC submit only one element of render List in page
body: <p>I have been looking for this answer here and in google without any success. I will explain what I´m looking for and let´s see if someone can help me.</p>
  
  <p>Using Spring MCV I´m rendering a List of A objects "aList" into my view.JSP.</p>
  
  <pre><code>    @RequestMapping(method = RequestMethod.GET)
      public final ModelAndView getAList(){
          ModelAndView mav = new ModelAndView("view");
          List&lt;A&gt; aList = new ArrayList&lt;&gt;();
          aList.add(new A("a1");
          aList.add(new A("a2");
          mav.addObject("aList", aList);
          return mav;
      }
  </code></pre>
  
  <p>Where A looks like</p>
  
  <pre><code>  public class A{
        @Getter
        @Setter
        private String value; 
        public A(String value){
               this.value=value;
         }
      }           
  </code></pre>
  
  <p>For every iteration of the list I´m creating a form. The form looks like</p>
  
  <pre><code>  &lt;c:forEach var="a" items="${aList}"
                 varStatus="status"&gt;
  
        &lt;form:form id="A${a.id}"
                 method="post" action="save.do"
                 modelAttribute="a"&gt;
  
                 &lt;input type="submit"  value="Save"/&gt;
        &lt;/form:form&gt;
    &lt;/c:forEach&gt;
  </code></pre>
  
  <p>so after finish the render I have so many forms as objects in my list.
  Every form as you can imagine has his submit button. 
  Now what I´m trying to do without any success is to send one of this form to my controller, but not the whole list of A that I render but A. So my controller will look something like.</p>
  
  <pre><code>   RequestMapping(value = "/save", method = RequestMethod.POST)
           public final ModelAndView save(@ModelAttribute("a") A a) {
  </code></pre>
  
  <p>But I´m receiving a "IllegalStateException: Neither BindingResult nor plain target object for bean name" because the render name of my modelAndView "aList" is not the same than "a".</p>
  
  <p>What I think I understand is that Spring MVC components like form dont allow submit a different class that was used in the render. Even if is a nested class of the render class, what is too bad.</p>
  
  <p>I would like to avoid have to send the aList again.</p>
  
  <p>Any idea?</p>
  
  <p>Regards.</p>