You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Hunter Hillegas <li...@lastonepicked.com> on 2003/04/21 23:19:31 UTC

ActionForms that contain collections of other ActionForms

Is it okay for an ActionForm to contain a collection of ActionForms as one
of its properties?

We have an application with the following flow:

1. Display page that allows user to specify the number of "items" in their
"request". This submits to a JSP page that displays a form.
2. This form contains some "header" information and then loops to create the
"items", the number of which is determined by the previous user input.
3. This form will submit to an Action that validates all of the data in the
header and the "items" and then commits some data to a database...

We're converting this application to Struts and I'm wondering if it is okay
to set it up as follows:

1. ActionForm for the "header" part. This ActionForm contains a collection
of "items".
2. Collection of "items" is a collection of ActionForms that model that part
of the form.

Will Struts be able to validate the ActionForm objects that are in the
collection?

How do I name the items in the HTML form (see Step 2 above) so that the
ActionForms that go in the collection auto-populate? Do I need to append
some kind of number?

Is there an example application that uses a similar flow?

Thanks,
Hunter



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org