spring mvc - how to submit object with list of sub-objects from JSP to Controller? -


i have class a having field of list of class b

class a{         private string x;        private string y;        private list<b> list; }  class b{        private string x1;       private string y1; } 

in jsp, have form there input field for x , y , c:foreach select b.

my question how make form can pass list of objects of type b inside a , send spring controller.

so far getting list 1 element.

you can use array. example :

<c:foreach items="${a.list}" varstatus="i">     <tr>         <td><form:input path="list[${i.index}].x1" type="text" /></td>         <td><form:input path="list[${i.index}].y1" type="text" /></td>     </tr> </c:foreach> 

and add , delete list rows in jsp used javascript..


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -