title: Variable amount of fields in Spring form
body: <p>I need to put variable amount of the same type of fields in the form. Let's say I have a command object</p>
  
  <pre><code>public class Person
    String name;
    String surname;
  
  // getters and setters
  </code></pre>
  
  <p>and a jsp</p>
  
  <pre><code>&lt;form:form command="personCommand"&gt;
    &lt;form:input path="name"/&gt;
    &lt;form:input path="surname"/&gt;
  &lt;/form:form&gt;
  </code></pre>
  
  <p>that's the standard way when I have a static number of fields. But what if I have something like</p>
  
  <pre><code>&lt;form:form command="personCommand"&gt;
    &lt;c:forEach items="${persons}"&gt;
      &lt;form:input path="name"/&gt;
      &lt;form:input path="surname"/&gt;
    &lt;/c:forEach&gt;
  &lt;/form:form&gt;
  </code></pre>
  
  <p>(which is of course incorrect) where the number of persons is unknown in advance? Is there some way in Spring to bind the fields in an array or a list maybe? Or some kind of workaround (currently I am concatenating the fields with javascript and separating them programatically which is Ugly).    </p>