OK, I've starting off down the Map-backed, manual indexing route, and it's
grim... It forces me to have model logic in three places - the JSP (to
create the keys into the map) and the two action classes (prepopulate, then
handle submit).
Is there a more elegant way of doing this stuff? (Or are there any plans to
provide this functionality in future releases?)
Thanks
Doug
-Original Message-
From: Doug Dixon [mailto:[EMAIL PROTECTED]
Sent: 31 January 2004 11:50
To: '[EMAIL PROTECTED]'
Subject: Populating a DynaActionForm with a complex object graph
Hi
I'm trying to populate a DynaActionForm dynamically, using this how-to as a
starting point: http://www.developer.com/java/other/article.php/2233591
Because the number of elements in my form can vary at runtime, I take the
advice near the bottom of the article:
""" You can even dynamically specify the size of the form (and
prepopulate it) at run time [...] by using an Action instead of a
forward to precreate the form-property value, and leaving the size
parameter out. The actual can then create an array of the appropriate
size and prepopulate values.."""
So my Action instantiates the right number of beans in the form and then
hands off to the JSP, no problem.
However, my model isn't a simple array (as in all the examples I can find) -
it's a complex object graph: I have one or more Flights, each of which can
contain one or more Passengers, each of which has multiple properties (name,
etc.)
This means I need another level of iteration, a bit like this (if it
worked!):
Flight
Passenger
Name:
This doesn't work - I just get HTML like this:
Flight
Passenger
Name:
Flight
Passenger
Name:
Which obviously won't work I need to end up with something like
Flight
Passenger
Name:
Flight
Passenger
Name:
Does anyone know if there is some way of doing this with DynaActionForms? Or
am I going to have to do nasty manual indexing with Map or List backed
ActionForms?
Thanks for any help
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]