I think I shot myself in the foot while stumbling along but I'll try to adapt this solution to my situation after I clear things up. I should be able to give it a shot tonight or tomorrow afternoon and will let you know how it works out for me.
Thanks for the tip! Peter > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On > Behalf Of Matt Ho > Sent: Friday, October 10, 2003 5:51 PM > To: [EMAIL PROTECTED] > Subject: Re: [OS-webwork] Need help with WW2 form processing... > > I'm clearer now on what you're looking to do. If > > that[0].Cheetah.name > that[1].Monkey.name > > works, then ModelDriven should work just fine. > > Having said that, the following code snippet should work for > you (haven't tested it though). This is slightly different > than what you asked for in that what you end up with in > animals is a list of AnimalHolders rather than animals. > > class MyAction implements ModelDriven { > private List animals = new OgnlList(AnimalHolder.class); > public Object getModel() { return this.animals ; } > ... > } > > class AnimalHolder { > private AbstractAnimal animal; > public AbstractAnimal getMonkey() throws Exception { > return this.getAnimal(Monkey.class); > } > public AbstractAnimal getCheetah() throws Exception { > return this.getAnimal(Cheetah.class); > } > public AbstractAnimal getAnimal(Class clazz) throws > Exception { > if( this.animal == null ) { > this.animal = clazz.newInstance(); > } > return this.animal; > } > } > > class OgnlList extends ArrayList { > private Class clazz; > > public OgnlList(Class clazz) { > this.clazz = clazz; > } > > public synchronized Object get(int index) { > while (index >= this.size()) { > try { > this.add(clazz.newInstance()); > } catch (Exception e) { > throw new RuntimeException(e); > } > } > return super.get(index); > } > } > > M > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: SF.net Giveback Program. > SourceForge.net hosts over 70,000 Open Source Projects. > See the people who have HELPED US provide better services: > Click here: http://sourceforge.net/supporters.php > _______________________________________________ > Opensymphony-webwork mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork > ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. SourceForge.net hosts over 70,000 Open Source Projects. See the people who have HELPED US provide better services: Click here: http://sourceforge.net/supporters.php _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork