Patrick Lightbody wrote:
Paul... yes and no (or, yes and not yet) :)
Check out WebWork Tip #1 on my blog:
http://www.lightbody.net/~plightbo/archives/000042.html
Basically, we already support doing it if there was just a single Item (or an array of Items), but when WW sees a List it currently has no way to know it needs to do "list.add(new Item())". Any suggestions as to how you'd like to tell WW that the type of the list is "Item" would be greatly appreciated. I originally thought of doing it in a hidden field, but then that could pose a huge security problem. I also thought of doing it in a properties file, but do we really want Yet Another Property File?
Pat
PS: I need more content for various WW tips. Please email me (plightbo -at- yahoo -dot- com) privately with suggestions or ideas on topics I should cover.
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paul Knepper Sent: Wednesday, January 07, 2004 10:59 AM To: [EMAIL PROTECTED] Subject: [OS-webwork] how to populate a list of objects from a form
I would like to have WW2 populate a list of objects from a form.
Say I have:
<form> <table> <tr> <input type="text" name="myProp1" /> <input type="text" name="myProp2" /> <input type="text" name="myProp3" /> </tr>
<tr> <input type="text" name="myProp1" /> <input type="text" name="myProp2" /> <input type="text" name="myProp3" /> </tr>
<tr> <input type="text" name="myProp1" /> <input type="text" name="myProp2" /> <input type="text" name="myProp3" /> </tr> </table> </form>
In my action class I have
public MyAction extends ActionSupport { private List itemsList = new ArrayList();
}
I also have a domain object class Item: class Item { private String myProp1; private String myProp2; private String myProp3;
... getters and setters }
Is there a way to have WebWork2 populate the itemsList List with instances of the Item class populated from the data in the table?
For each row in the table an instance of the Item object should be inserted into the
itemsList property of the action class.
Thanks, Paul
------------------------------------------------------- This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
------------------------------------------------------- This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
------------------------------------------------------- This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork