If I am generating a dynamic row based form, how can I submit the form elements to the action in a structured manner.
I know it is possible to submit form elements as a collection by giving the fields the same name as in: (the same would work for multi select checkboxes) <INPUT type="textbox" name="addField" value="field value1"> <INPUT type="textbox" name="addField" value="field value2"> <INPUT type="textbox" name="addField" value="field value3"> I would like to take it one step furthur and be able to submit data as a table with an arbitrary number of rows. A collection of hashes would be good way. For example: <INPUT type="textbox" name="row[0]{field1}" value="row 1 field value1"> <INPUT type="textbox" name="row[0]{field2}" value="row 1 field value2"> <INPUT type="textbox" name="row[0]{field3}" value="row 1 field value3"> <INPUT type="textbox" name="row[1]{field1}" value="row 2 field value1"> <INPUT type="textbox" name="row[1]{field2}" value="row 2 field value2"> <INPUT type="textbox" name="row[1]{field3}" value="row 3 field value3"> ... So the action would have a setter for rows: public void setRows(Collection row) { //print out the rows Iterator it = row.iterator(); while(it.hasNext()) { HashMap rowData = (HashMap)it.next(); System.out.println(rowData.get("field1")); System.out.println(rowData.get("field2")); System.out.println(rowData.get("field3")); } Even better would be to map it directly to a value object for the row if possible public void setRows(Collection row) { //print out the rows Iterator it = row.iterator(); while(it.hasNext()) { Row rowData = (Row)it.next(); System.out.println(rowData.getField1()); System.out.println(rowData.getField2()); System.out.println(rowData.getField3()); } So in essence webworks could parse the form element name as "ObjectName[ObjectIndex]{FieldName}". thanks, Alex. ------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork