If it works for you, then rock on :) robert
> -----Original Message----- > From: Marcus Peixoto [mailto:[EMAIL PROTECTED] > Sent: Friday, December 12, 2003 2:42 PM > To: Struts Users Mailing List > Subject: RE: dynamically sized form (mostly solved) > > > Robert, > > I tried to use LazyList but I couldn't just put the class in the form > definitions (I'm using dynavalidatoractionform). Besides, I also have to > create a Form class and overide reset method. > It seems that the code below is more easy to implement, since you just > have to extend arraylist and place the new class directly in Form > definition. > > Marcus > > Em Sex, 2003-12-12 Ãs 15:58, Robert Taylor escreveu: > > org.apache.commons.collections.ListUtils.lazyList() does this as well > > without having to extend anything. > > > > > http://jakarta.apache.org/commons/collections/api/org/apache/commo > ns/collect > > ions/ListUtils.html#lazyList > > > > robert > > > > > -----Original Message----- > > > From: Nifty Music [mailto:[EMAIL PROTECTED] > > > Sent: Friday, December 12, 2003 11:59 AM > > > To: [EMAIL PROTECTED] > > > Subject: RE: dynamically sized form (mostly solved) > > > > > > > > > Andy & others.... > > > > > > Thanks to the help of all of you on the list, I've been able to > > > fully implement using an ArrayList with a DynaValidatorForm in > > > request scope. Special thanks to John Steele for finding the key > > > for doing this. Using his idea, I implemented a special class > > > which extends ArrayList, providing an overridden get() method > > > which adds a new instance of a specified class whenever the > > > requested position is greater than the current size of the list. > > > I haven't looked into the LazyList stuff too much, but it sounds > > > like that would probably accomplish the same sort of thing. The > > > code is as follows: > > > > > > public class DynamicItemRangesList extends ArrayList { > > > private Logger log = > Logger.getLogger(DynamicList.class); > > > > > > /** > > > * This version of get will expand the list as needed to > > > always return > > > * an ItemRangesCDTO. Blank objects will be added to the list. > > > */ > > > public Object get(int pos) { > > > while ( this.size() <= pos ) { > > > try { > > > > > > this.add(ItemRangesCDTO.class.newInstance()); > > > } catch ( Exception e ) { > > > logger.error(e); > > > } > > > } > > > return super.get(pos); > > > } > > > } > > > > > > Then, in my struts-config.xml file, I declared the following > form-bean: > > > > > > <form-bean name="inventoryModifyForm" > > > type="org.apache.struts.validator.DynaValidatorForm"> > > > <form-property name="page" type="java.lang.Integer" /> > > > <form-property name="submit" > > > type="java.lang.String" /> <form-property > > > name="rangeStart" type="java.lang.String" /> > > > <form-property name="rangeEnd" > > > type="java.lang.String" /> > > > <form-property name="inventoryList" > > > type="gov.dor.fastr.util.DynamicItemRangesList" /> > > > <form-property name="description" type="java.lang.String" > > > /> </form-bean> > > > > > > ..and the following action-mapping: > > > > > > <action path="/inventoryModifyPopulate" > > > type="gov.dor.fastr.action.inventory.InventoryModifyPopulateAction" > > > name="inventoryModifyForm" > > > scope="request" > > > validate="false"> > > > <forward name="error" path="fastr.errors" /> > > > <forward name="success" path="inventory.modify" /> > > > </action> > > > > > > This solution works like a charm. Thanks again to everyone for > > > helping me! I greatly appreciate it! > > > > > > Thanks, > > > > > > Brent > > > > > > > > > >Thanks, I figured it out, but it still didn't work. I talked with the > > > >lead developer, and we decided to just use session scope for > this, and > > > >now it works. > > > > > > > >-Andy > > > ____________________________________________________________ > > > This message sent using iMail from I-Land Internet Services. > > > http://www.iland.net > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]