now i understand you're renaming the dynamically added textboxes thru Javascript? right? if that's the case your renaming looks good to me. can you do the trick in the form's reset() method; that is, set the a new Customer array to the forms's property with something like:
String value = request.getParameter("customer[0].firstName"); if (value != null) { int count = 1; while ((value = request.getParameter("customer[" + count + "].firstName")) != null) { count++; } } Customer[] customers = new Customer[count]; f.set("customer", customers); On 12/18/05, Irfan Shaikh <[EMAIL PROTECTED]> wrote: > > No, user can add has many row he needed before submit... I had just added > one row to handle this scenario... It should work for as many row user has > added... > > > On 12/19/05, atta-ur rehman <[EMAIL PROTECTED]> wrote: > > > > okay, so you're saying use can add only ONE row dynamically before > submit? > > and that the newly added row's HTML code is: > > > > <tr> > > <td><input type="checkbox" name="id" value="yes"></td> > > <td><input type="text" name="customer[4].firstName" > > value="John"></td> > > <td><input type="text" name="customer[4].lastName" > > value="Mark"></td> > > <td><input type="text" name="customer[4].address" value="New > > York"></td> > > </tr> <!--This is the HTML of hardcoded row--> > > > > > > if that's the case, in your ActionForm's reset method, detect that user > > has > > added a new row, maybe thru request.getParameter > ("customer[?].firstName") > > where ? will be an integer 0..n where reuqest.getParameter would return > > null > > for n+1. once you've done that do a: > > > > Customer[] customers = new Customer[n]; > > form.set("customer", customers); > > > > see if that helps. > > > > ATTA > > > > > > On 12/18/05, Irfan Shaikh <[EMAIL PROTECTED]> wrote: > > > > > > Once again Generated HTML : > > > > > > <form name="listTextForm" method="post" > > > action="/GenerateHTMLTable/listtext.do"> > > > > > > <input type="submit" value="Submit"> > > > <br> > > > <table width="30%" border="0"> > > > <colgroup> > > > > > > <COL width="5"> > > > <COL width="30"> > > > <COL width="30"> > > > <COL width="35"> > > > </colgroup> > > > > > > <!--Session Scope --> > > > > > > <tr> > > > <td><input type="checkbox" name="id" value="yes"></td> > > > <td><input type="text" name="customer[0].firstName" > > > value="Irfan"></td> > > > > > > <td><input type="text" name="customer[0].lastName" > > > value="Shaikh"></td> > > > <td><input type="text" name="customer[0].address" value="New > > > Mumbai"></td> > > > </tr> > > > > > > <tr> > > > <td><input type="checkbox" name="id" value="yes"></td> > > > <td><input type="text" name="customer[1].firstName" > > > value="Maruf1212"></td> > > > <td><input type="text" name="customer[1].lastName" > > > value="Dolani"></td> > > > <td><input type="text" name="customer[1].address" > > > value="Mumbai"></td> > > > </tr> > > > > > > <tr> > > > <td><input type="checkbox" name="id" value="yes"></td> > > > > > > <td><input type="text" name="customer[2].firstName" > > > value="Azima121111"></td> > > > <td><input type="text" name="customer[2].lastName" > > > value="Kacchi"></td> > > > <td><input type="text" name="customer[2].address" > > > value="Pune"></td> > > > </tr> > > > > > > <tr> > > > <td><input type="checkbox" name="id" value="yes"></td> > > > <td><input type="text" name="customer[3].firstName" > > > value="Ruhi11133"></td> > > > <td><input type="text" name="customer[3].lastName" > > > value="Khan"></td> > > > <td><input type="text" name="customer[3].address" > > > value="Pune"></td> > > > </tr> > > > > > > > > > <tr> > > > <td><input type="checkbox" name="id" value="yes"></td> > > > <td><input type="text" name="customer[4].firstName" > > > value="John"></td> > > > <td><input type="text" name="customer[4].lastName" > > > value="Mark"></td> > > > <td><input type="text" name="customer[4].address" value="New > > > York"></td> > > > </tr> (Hardcoded HTML row) > > > > > > </table> > > > > > > > > > </form> > > > > > > > > > > > >