Re: dynamically sized form (mostly solved)
Sorry I forgot the reason for this cognitive preservation with lazyList.. Arraylist works fine.. Even better if you ditch dyna forms in favour of action forms.. On 15 Dec 2003, at 15:44, Andy Schmidgall wrote: Robert, I also could not get LazyList to work with our DynaForms. -Andy -Original Message- From: Marcus Peixoto [mailto:[EMAIL PROTECTED] Sent: Friday, December 12, 2003 1: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/commons/c ollect 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: ..and the following action-mapping: 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: dynamically sized form (mostly solved)
Robert, I also could not get LazyList to work with our DynaForms. -Andy -Original Message- From: Marcus Peixoto [mailto:[EMAIL PROTECTED] Sent: Friday, December 12, 2003 1: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/commons/c > ollect > 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: > > > > > type="org.apache.struts.validator.DynaValidatorForm"> > > > > > type="java.lang.String" /> > name="rangeStart" type="java.lang.String" /> > > > > > type="gov.dor.fastr.util.DynamicItemRangesList" /> > > > /> > > > > ..and the following action-mapping: > > > > > type="gov.dor.fastr.action.inventory.InventoryModifyPopulateAction" > > name="inventoryModifyForm" > > scope="request" > > validate="false"> > > > > > > > > > > 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]
RE: dynamically sized form (mostly solved)
Actually it didn't. It has the same limitations. I still have to inform a particular element to method get (ItemsRangesCDTO): 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); I'm looking for a simple solution that works for my whole application. Well, it's Christmas time. Who knows. > 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: > > > > > > > > > > > type="org.apache.struts.validator.DynaValidatorForm"> > > > > > > > > > > > type="java.lang.String" /> > > > name="rangeStart" type="java.lang.String" /> > > > > > > > type="java.lang.String" /> > > > > > > > type="gov.dor.fastr.util.DynamicItemRangesList" /> > > > > > > > /> > > > > > > > > ..and the following action-mapping: >
RE: dynamically sized form (mostly solved)
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: > > > > > > > > type="org.apache.struts.validator.DynaValidatorForm"> > > > > > >> > type="java.lang.String" /> > > name="rangeStart" type="java.lang.String" /> > > >> > type="java.lang.String" /> > > >> > type="gov.dor.fastr.util.DynamicItemRangesList" /> > > >> > /> > > > > > > ..and the following action-mapping: > > > > > > > > type="gov.dor.fastr.action.inventory.InventoryModifyPopulateAction" > > > name="inventoryModifyForm" > > > scope="request" > > > validate="false"> > > > > > > > > > > > > > > > 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]
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/commons/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: > > > > > type="org.apache.struts.validator.DynaValidatorForm"> > > > > > type="java.lang.String" /> > name="rangeStart" type="java.lang.String" /> > > > type="java.lang.String" /> > > > type="gov.dor.fastr.util.DynamicItemRangesList" /> > > > /> > > > > ..and the following action-mapping: > > > > > type="gov.dor.fastr.action.inventory.InventoryModifyPopulateAction" > > name="inventoryModifyForm" > > scope="request" > > validate="false"> > > > > > > > > > > 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]
RE: dynamically sized form (mostly solved)
org.apache.commons.collections.ListUtils.lazyList() does this as well without having to extend anything. http://jakarta.apache.org/commons/collections/api/org/apache/commons/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: > > type="org.apache.struts.validator.DynaValidatorForm"> > >type="java.lang.String" /> name="rangeStart" type="java.lang.String" /> >type="java.lang.String" /> >type="gov.dor.fastr.util.DynamicItemRangesList" /> >/> > > ..and the following action-mapping: > > type="gov.dor.fastr.action.inventory.InventoryModifyPopulateAction" > name="inventoryModifyForm" > scope="request" > validate="false"> > > > > > 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]
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: ..and the following action-mapping: 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]
Re: dynamically sized form (mostly solved)
Hi All. Sorry I am jumping in a bit late on this since I am the one who probably caused a lot of the confusion. I am the one who originally said I had this working with the form under the request scope - I was wrong. The form needs to be under the session scope for this to work or you will get the beanutils.populate errors. Matt Bathje - Original Message - From: "Andy Schmidgall" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Wednesday, December 10, 2003 4:01 PM Subject: RE: dynamically sized form (mostly solved) > Does this mean it's impossible to do through request scope? I am > attempting to do this, and it would be nice to know if my work is in > vain :) > > -Andy > > -Original Message- > From: Yee, Richard K,,DMDCWEST [mailto:[EMAIL PROTECTED] > Sent: Wednesday, December 10, 2003 3:20 PM > To: 'Struts Users Mailing List' > Subject: RE: dynamically sized form (mostly solved) > > > I thought it worked, but it didn't. > > -Richard > > -Original Message- > From: Nifty Music [mailto:[EMAIL PROTECTED] > Sent: Wednesday, December 10, 2003 1:02 PM > To: [EMAIL PROTECTED] > Subject: RE: dynamically sized form (mostly solved) > > > Nicholas, > > What you said definitely makes sense to me. Richard graciously replied > off-list with a similar response. I remember reading documentation > which stated that when using dynamic arrays with DynaForms, it is > necessary to place the DynaForm in session scope. However, I 'm almost > positive that someone (Matt? Mark?) mentioned on this list that they > were able to pass an ArrayList through a DynaForm in request scope. For > a variety of reasons, I'm not too eager to put the entire formbean in > the session for the sake of propogating one ArrayList attribute. If > Matt or Mark or anyone else has some insights to share regarding how > they were able to get this to work in request scope, I'd be very > grateful to hear. > > Thanks again, > > Brent > > > - > 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]
Re: dynamically sized form (mostly solved)
I'm sure it's come up before, but a link to the Commons ListUtils might be helpful here: http://tinyurl.com/87fs What Robert is doing seems like the cannonical solution to me. In many cases just specifying a classname in the configuration wouldn't be enough, and so you need to use reset as well. The other thing to note is that reset files before any autopopulation takes place.(It's the prepopulation extension point.) Then, if validation, passes, the Action class (if any) fires. HTH. Ted. Robert Taylor wrote: Nicholas, I use DynaActionValidatorForm almost exclusively in my application. I have successfully used IndexedProperties for structures that are dynamic using LazyLists. For me, when ever I have to do this, I always have to think about how Struts handles the sequence of events in a request and submission. What I do is subclass DynaActionValidatorForm and override the reset(). The reset() gets called before the action is executed. For example: /** * Reset all bean properties to their default state. This method is * called before the properties are repopulated by the controller servlet. * * The default implementation uses the initial value specified in the * FormPropertyConfig element for each property. * * @param mapping The mapping used to select this instance * @param request The servlet request we are processing */ public void reset(ActionMapping mapping, HttpServletRequest request) { super.reset(mapping, request); /* * We have to create lazy lists for selected items * because we don't know which items will index * into the collection. A lazy list will create * the appropriate item at a specified index if it * doesn't exist there. */ List selectedItems = ListUtils .lazyList(new ArrayList(), new SelectedItemFactory()); this.set("selectedItems", selectedItems); // other stuff here if necessary } My Factory classes are usually inner classes to the subclassed Dyna*Form. For example: /** * SelectedItemFactory is used in the form * to create a lazy list that will lazily create selected items. * * @author Robert Taylor * @author last modified $Author: rtaylor $ * @version $Revision: 1.8 $ $Date: 2003/11/17 13:58:51 $ * @see org.apache.commons.ListUtils */ class SelectedItemFactory implements Factory { /** * Create a new instance of the specified object */ public Object create() { return new SelectedItemVO(); } } As long as the input fields which are added to the client have the correct syntax for indexing into your form (formName.selectedItems[0].fieldName) then Struts should handle the rest. Does that help at all? robert -Original Message- From: Nicholas L Mohler [mailto:[EMAIL PROTECTED] Sent: Thursday, December 11, 2003 7:46 AM To: Struts Users Mailing List Subject: Re: dynamically sized form (mostly solved) Ted, The origin of this thread had to do with using Indexed Properties and a Dyna* form. As when using the ActionForm, getting the values to the browser is not an issue. The area where the difficulty arises is when the values are returned from the browser. When using the ActionForm (or subclass), this is neatly handled by implementing the LazyList (or similar functionality) or by making the form have session scope. Note that the session scope solution fails if the end-user can add new entries to the list without a call to the server. In the app I work on, we use javascript to add and remove list elements, so we use LazyList functionality. The problem is when the Dyna* type forms are used. How do the indexed properties get back into the form when the page is submitted. Similar to ActionForm based implementations, the form can have session scope, but this also fails if the user can add new entries to the list without a server call. It isn't obvoius how one would implement LazyList type functionality in a dyna form. I have seen the suggestions for map-backed forms, but I don't see how this would help for the indexed properties...how it would be different from just grabbing the indexed properties out of the request. Any thoughts on this? Nick Ted Husted <[EMAIL PROTECTED]To: Struts Users Mailing List <[EMAIL PROTECTED]> g> cc: Subject: Re: dynamically sized form (mostly solved) 12/11/2003 07:03 AM Please respond to "Struts Users Mailing List" I've lost track of the underlying use case for this thread, but if it's about populating input options on a form, you might consider using a second object for storing these types of options. For a time, some of us were starting to use the ActionForm to r
RE: dynamically sized form (mostly solved)
#2 robert > -Original Message- > From: Nicholas L Mohler [mailto:[EMAIL PROTECTED] > Sent: Thursday, December 11, 2003 9:32 AM > To: Struts Users Mailing List > Subject: RE: dynamically sized form (mostly solved) > > > > > > > > Robert, > > What you are saying makes perfect sense. You subclass the dyna form and > provide an implemtation of the LazyList, about the same as we > would do with > an ActionForm based solution. > > Do you have a single dyna form subclass or multiple? For example, in our > app, we have 8 objects that are used as indexed properties across our > various editors. In such a situation, would you have a single subclass > that would provide the factory definitions for each of the objects, or > would you have multiple subclasses that would each provide the factory > definitions that the form was responsible for? > > In case I'm not clear in my question, if you had a: > (1) Family Editor that allows the user to manage a collection of > FamilyMember objects. I would have a FamilyForm with a collection of > FamilyMemberForm objects supported by LazyList. > (2) FamilyMember editor that allows the user to manage a collection of > favorite meals. I would have a FamilyMemberForm with a collection of > FavoriteMeal objects supported by LazyList > > Would you have two subclasses of dyna form or just one with both > collections being set up in the reset method. > > Nick > > > > |-+> > | | "Robert Taylor" | > | | <[EMAIL PROTECTED]| > | | .com>| > | || > | | 12/11/2003 08:52 | > | | AM | > | | Please respond to| > | | "Struts Users| > | | Mailing List"| > | || > |-+> > > >- > -| > | > | > | To: "Struts Users Mailing List" > <[EMAIL PROTECTED]> >| > | cc: >| > | Subject: RE: dynamically sized form (mostly solved) >| > > >- > -| > > > > > Nicholas, > > I use DynaActionValidatorForm almost exclusively in my application. > I have successfully used IndexedProperties for structures that are dynamic > using LazyLists. > > For me, when ever I have to do this, I always have to think about how > Struts > handles the sequence of events in a request and submission. > > What I do is subclass DynaActionValidatorForm and override the reset(). > The reset() gets called before the action is executed. > > For example: > > /** > * Reset all bean properties to their default state. This method is > * called before the properties are repopulated by the controller servlet. > * > * The default implementation uses the initial value specified in the > * FormPropertyConfig element for each property. > * > * @param mapping The mapping used to select this instance > * @param request The servlet request we are processing > */ > public void reset(ActionMapping mapping, HttpServletRequest request) { > > super.reset(mapping, request); > > > /* > * We have to create lazy lists for selected items > * because we don't know which items will index > * into the collection. A lazy list will create > * the appropriate item at a specified index if it > * doesn't exist there. > */ > List selectedItems = ListUtils > .lazyList(new ArrayList(), new > SelectedItemFactory > ()); > > this.set("selectedItems", selectedItems); > > // other stuff here if necessary > } > > > My Factory classes are usually inner classes to the subclassed > Dyna*Form. > > For example: > > /** > * SelectedItemFactory is used in the form > * to create a lazy list that will lazily create selected items. > * > * @author Robert Taylor > * @author last modified $Author: rtaylor $ > * @version $Revision: 1.8 $ $Date: 2003/11/17 13:58:51 $ > * @see org.apache.commons.ListUtils > */ > class S
RE: dynamically sized form (mostly solved)
If you have multiple checkbox fields with the same name, you should use . In your form you should define that field type to be String[]. Multiple radio boxes implies that out of many choices, you want a single value sent to the server. Neither of these scenarios warrent the use of indexed properties. In your action class you should simple get your form and access the property. No extra classes of forms. robert > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] > Sent: Thursday, December 11, 2003 9:09 AM > To: [EMAIL PROTECTED] > Cc: [EMAIL PROTECTED] > Subject: AW: dynamically sized form (mostly solved) > > > Hallo Robert, > > I am having the same problems. I have a dynaActionvalidator form > which has a few normal fields and an array of check or radio boxes > which should have the same field name. > > My question is how do you implement this in the action class and > and form bean > and how does this Class come into play? Is it a separate class in > addition to > the ActionForm and if so how is it called for redisplay in the jsp? > > Sam > > -Ursprungliche Nachricht- > Von: Robert Taylor [mailto:[EMAIL PROTECTED] > Gesendet: Donnerstag, 11. Dezember 2003 14:52 > An: Struts Users Mailing List > Betreff: RE: dynamically sized form (mostly solved) > > > Nicholas, > > I use DynaActionValidatorForm almost exclusively in my application. > I have successfully used IndexedProperties for structures that are dynamic > using LazyLists. > > For me, when ever I have to do this, I always have to think about > how Struts > handles the sequence of events in a request and submission. > > What I do is subclass DynaActionValidatorForm and override the reset(). > The reset() gets called before the action is executed. > > For example: > > /** > * Reset all bean properties to their default state. This method is > * called before the properties are repopulated by the controller servlet. > * > * The default implementation uses the initial value specified in the > * FormPropertyConfig element for each property. > * > * @param mapping The mapping used to select this instance > * @param request The servlet request we are processing > */ > public void reset(ActionMapping mapping, HttpServletRequest request) { > > super.reset(mapping, request); > > > /* > * We have to create lazy lists for selected items > * because we don't know which items will index > * into the collection. A lazy list will create > * the appropriate item at a specified index if it > * doesn't exist there. > */ > List selectedItems = ListUtils > .lazyList(new ArrayList(), new SelectedItemFactory()); > > this.set("selectedItems", selectedItems); > > // other stuff here if necessary > } > > > My Factory classes are usually inner classes to the subclassed > Dyna*Form. > > For example: > > /** > * SelectedItemFactory is used in the form > * to create a lazy list that will lazily create selected items. > * > * @author Robert Taylor > * @author last modified $Author: rtaylor $ > * @version $Revision: 1.8 $ $Date: 2003/11/17 13:58:51 $ > * @see org.apache.commons.ListUtils > */ > class SelectedItemFactory implements Factory { > > /** > * Create a new instance of the specified object > */ > public Object create() { > > return new SelectedItemVO(); > } > > } > > > As long as the input fields which are added to the client have the correct > syntax > for indexing into your form (formName.selectedItems[0].fieldName) then > Struts should > handle the rest. > > Does that help at all? > > robert > > > > > -Original Message- > > From: Nicholas L Mohler [mailto:[EMAIL PROTECTED] > > Sent: Thursday, December 11, 2003 7:46 AM > > To: Struts Users Mailing List > > Subject: Re: dynamically sized form (mostly solved) > > > > > > > > > > > > > > > > Ted, > > > > The origin of this thread had to do with using Indexed Properties and a > > Dyna* form. As when using the ActionForm, getting the values to the > > browser is not an issue. The area where the difficulty arises > is when the > > values are returned from the browser. > > > > When using the ActionForm (or subclass), this is neatly handled by > > implementing the LazyList (or similar functionality) or by > making the form > > have session scope. Note that the session scope solution fails if the > > end-user can add new entries to the list without a ca
RE: dynamically sized form (mostly solved)
Robert, What you are saying makes perfect sense. You subclass the dyna form and provide an implemtation of the LazyList, about the same as we would do with an ActionForm based solution. Do you have a single dyna form subclass or multiple? For example, in our app, we have 8 objects that are used as indexed properties across our various editors. In such a situation, would you have a single subclass that would provide the factory definitions for each of the objects, or would you have multiple subclasses that would each provide the factory definitions that the form was responsible for? In case I'm not clear in my question, if you had a: (1) Family Editor that allows the user to manage a collection of FamilyMember objects. I would have a FamilyForm with a collection of FamilyMemberForm objects supported by LazyList. (2) FamilyMember editor that allows the user to manage a collection of favorite meals. I would have a FamilyMemberForm with a collection of FavoriteMeal objects supported by LazyList Would you have two subclasses of dyna form or just one with both collections being set up in the reset method. Nick |-+> | | "Robert Taylor" | | | <[EMAIL PROTECTED]| | | .com>| | || | | 12/11/2003 08:52 | | | AM | | | Please respond to| | | "Struts Users| | | Mailing List"| | || |-+> >--| | | | To: "Struts Users Mailing List" <[EMAIL PROTECTED]> | | cc: | | Subject: RE: dynamically sized form (mostly solved) | >--| Nicholas, I use DynaActionValidatorForm almost exclusively in my application. I have successfully used IndexedProperties for structures that are dynamic using LazyLists. For me, when ever I have to do this, I always have to think about how Struts handles the sequence of events in a request and submission. What I do is subclass DynaActionValidatorForm and override the reset(). The reset() gets called before the action is executed. For example: /** * Reset all bean properties to their default state. This method is * called before the properties are repopulated by the controller servlet. * * The default implementation uses the initial value specified in the * FormPropertyConfig element for each property. * * @param mapping The mapping used to select this instance * @param request The servlet request we are processing */ public void reset(ActionMapping mapping, HttpServletRequest request) { super.reset(mapping, request); /* * We have to create lazy lists for selected items * because we don't know which items will index * into the collection. A lazy list will create * the appropriate item at a specified index if it * doesn't exist there. */ List selectedItems = ListUtils .lazyList(new ArrayList(), new SelectedItemFactory ()); this.set("selectedItems", selectedItems); // other stuff here if necessary } My Factory classes are usually inner classes to the subclassed Dyna*Form. For example: /** * SelectedItemFactory is used in the form * to create a lazy list that will lazily create selected items. * * @author Robert Taylor * @author last modified $Author: rtaylor $ * @version $Revision: 1.8 $ $Date: 2003/11/17 13:58:51 $ * @see org.apache.commons.ListUtils */ class SelectedItemFactory implements Factory { /** * Create a new instance of the specified object */ public Object create() { return new SelectedItemVO(); } } As long as the input fields which are added to the client have the correct syntax for indexing into your form (formName.selectedItems[0].fieldName) then Struts should handle the rest. Does that help at all? robert > -Original Message- > From: Nicholas L Mohler [mailto:[EMAIL PROTECTED] > Sent: Thursday, December 11, 2003 7:46 AM > To: Struts Users Mailing List > Subject: Re: dynamically sized form (mostly solved) > > > > > > > > Ted, > > The origin
RE: dynamically sized form (mostly solved)
Nicholas, I use DynaActionValidatorForm almost exclusively in my application. I have successfully used IndexedProperties for structures that are dynamic using LazyLists. For me, when ever I have to do this, I always have to think about how Struts handles the sequence of events in a request and submission. What I do is subclass DynaActionValidatorForm and override the reset(). The reset() gets called before the action is executed. For example: /** * Reset all bean properties to their default state. This method is * called before the properties are repopulated by the controller servlet. * * The default implementation uses the initial value specified in the * FormPropertyConfig element for each property. * * @param mapping The mapping used to select this instance * @param request The servlet request we are processing */ public void reset(ActionMapping mapping, HttpServletRequest request) { super.reset(mapping, request); /* * We have to create lazy lists for selected items * because we don't know which items will index * into the collection. A lazy list will create * the appropriate item at a specified index if it * doesn't exist there. */ List selectedItems = ListUtils .lazyList(new ArrayList(), new SelectedItemFactory()); this.set("selectedItems", selectedItems); // other stuff here if necessary } My Factory classes are usually inner classes to the subclassed Dyna*Form. For example: /** * SelectedItemFactory is used in the form * to create a lazy list that will lazily create selected items. * * @author Robert Taylor * @author last modified $Author: rtaylor $ * @version $Revision: 1.8 $ $Date: 2003/11/17 13:58:51 $ * @see org.apache.commons.ListUtils */ class SelectedItemFactory implements Factory { /** * Create a new instance of the specified object */ public Object create() { return new SelectedItemVO(); } } As long as the input fields which are added to the client have the correct syntax for indexing into your form (formName.selectedItems[0].fieldName) then Struts should handle the rest. Does that help at all? robert > -Original Message- > From: Nicholas L Mohler [mailto:[EMAIL PROTECTED] > Sent: Thursday, December 11, 2003 7:46 AM > To: Struts Users Mailing List > Subject: Re: dynamically sized form (mostly solved) > > > > > > > > Ted, > > The origin of this thread had to do with using Indexed Properties and a > Dyna* form. As when using the ActionForm, getting the values to the > browser is not an issue. The area where the difficulty arises is when the > values are returned from the browser. > > When using the ActionForm (or subclass), this is neatly handled by > implementing the LazyList (or similar functionality) or by making the form > have session scope. Note that the session scope solution fails if the > end-user can add new entries to the list without a call to the server. In > the app I work on, we use javascript to add and remove list > elements, so we > use LazyList functionality. > > The problem is when the Dyna* type forms are used. How do the indexed > properties get back into the form when the page is submitted. Similar to > ActionForm based implementations, the form can have session > scope, but this > also fails if the user can add new entries to the list without a server > call. It isn't obvoius how one would implement LazyList type > functionality > in a dyna form. > > I have seen the suggestions for map-backed forms, but I don't see how this > would help for the indexed properties...how it would be different > from just > grabbing the indexed properties out of the request. > > Any thoughts on this? > Nick > > > > > > > Ted Husted > > <[EMAIL PROTECTED]To: Struts > Users Mailing List <[EMAIL PROTECTED]> > g> cc: > >Subject: Re: > dynamically sized form (mostly solved) 12/11/2003 07:03 > AM > > Please respond to > > "Struts Users > > Mailing List" > > > > > > > > > > I've lost track of the underlying use case for this thread, but if it's > about populating input options on a form, you might consider using a > second object for storing these types of options. For a time, some of us > were starting to use the ActionForm to represent the input options along > with the input values. This notion had more to do with code maintenance > than architecture. At this point, I would suggest
Re: dynamically sized form (mostly solved)
Ted, The origin of this thread had to do with using Indexed Properties and a Dyna* form. As when using the ActionForm, getting the values to the browser is not an issue. The area where the difficulty arises is when the values are returned from the browser. When using the ActionForm (or subclass), this is neatly handled by implementing the LazyList (or similar functionality) or by making the form have session scope. Note that the session scope solution fails if the end-user can add new entries to the list without a call to the server. In the app I work on, we use javascript to add and remove list elements, so we use LazyList functionality. The problem is when the Dyna* type forms are used. How do the indexed properties get back into the form when the page is submitted. Similar to ActionForm based implementations, the form can have session scope, but this also fails if the user can add new entries to the list without a server call. It isn't obvoius how one would implement LazyList type functionality in a dyna form. I have seen the suggestions for map-backed forms, but I don't see how this would help for the indexed properties...how it would be different from just grabbing the indexed properties out of the request. Any thoughts on this? Nick Ted Husted <[EMAIL PROTECTED]To: Struts Users Mailing List <[EMAIL PROTECTED]> g> cc: Subject: Re: dynamically sized form (mostly solved) 12/11/2003 07:03 AM Please respond to "Struts Users Mailing List" I've lost track of the underlying use case for this thread, but if it's about populating input options on a form, you might consider using a second object for storing these types of options. For a time, some of us were starting to use the ActionForm to represent the input options along with the input values. This notion had more to do with code maintenance than architecture. At this point, I would suggest using finely-grained DynaActionForms to represent only the input required by an action. All other constructs, like arraylists for select boxes and so forth, can be put on a second "chrome" bean. A distinct advantage here is that you can scope the chrome bean as appropriate. A global default can live in applidcation scope, and other can live in session or request scope, as appropriate to a request. HTH, Ted. Andy Schmidgall wrote: > Does this mean it's impossible to do through request scope? I am > attempting to do this, and it would be nice to know if my work is in > vain :) > > -Andy > > -Original Message- > From: Yee, Richard K,,DMDCWEST [mailto:[EMAIL PROTECTED] > Sent: Wednesday, December 10, 2003 3:20 PM > To: 'Struts Users Mailing List' > Subject: RE: dynamically sized form (mostly solved) > > > I thought it worked, but it didn't. > > -Richard > > -Original Message- > From: Nifty Music [mailto:[EMAIL PROTECTED] > Sent: Wednesday, December 10, 2003 1:02 PM > To: [EMAIL PROTECTED] > Subject: RE: dynamically sized form (mostly solved) > > > Nicholas, > > What you said definitely makes sense to me. Richard graciously replied > off-list with a similar response. I remember reading documentation > which stated that when using dynamic arrays with DynaForms, it is > necessary to place the DynaForm in session scope. However, I 'm almost > positive that someone (Matt? Mark?) mentioned on this list that they > were able to pass an ArrayList through a DynaForm
Re: dynamically sized form (mostly solved)
Ted Sorry I'm not really sure what you mean by "chrome bean". Or how one would go about scoping one to session while the action form (dyna or otherwise) is scoped the request. Do you mean you have a bean that persists beyond the form submission in which you can store the user input until such a time that it can be passed up to the model? (thus placing the action form back into the presentation layer) Many thanks Mark On 11 Dec 2003, at 12:03, Ted Husted wrote: I've lost track of the underlying use case for this thread, but if it's about populating input options on a form, you might consider using a second object for storing these types of options. For a time, some of us were starting to use the ActionForm to represent the input options along with the input values. This notion had more to do with code maintenance than architecture. At this point, I would suggest using finely-grained DynaActionForms to represent only the input required by an action. All other constructs, like arraylists for select boxes and so forth, can be put on a second "chrome" bean. A distinct advantage here is that you can scope the chrome bean as appropriate. A global default can live in applidcation scope, and other can live in session or request scope, as appropriate to a request. HTH, Ted. Andy Schmidgall wrote: Does this mean it's impossible to do through request scope? I am attempting to do this, and it would be nice to know if my work is in vain :) -Andy -Original Message- From: Yee, Richard K,,DMDCWEST [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 10, 2003 3:20 PM To: 'Struts Users Mailing List' Subject: RE: dynamically sized form (mostly solved) I thought it worked, but it didn't. -Richard -Original Message- From: Nifty Music [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 10, 2003 1:02 PM To: [EMAIL PROTECTED] Subject: RE: dynamically sized form (mostly solved) Nicholas, What you said definitely makes sense to me. Richard graciously replied off-list with a similar response. I remember reading documentation which stated that when using dynamic arrays with DynaForms, it is necessary to place the DynaForm in session scope. However, I 'm almost positive that someone (Matt? Mark?) mentioned on this list that they were able to pass an ArrayList through a DynaForm in request scope. For a variety of reasons, I'm not too eager to put the entire formbean in the session for the sake of propogating one ArrayList attribute. If Matt or Mark or anyone else has some insights to share regarding how they were able to get this to work in request scope, I'd be very grateful to hear. Thanks again, Brent - 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]
Re: dynamically sized form (mostly solved)
I've lost track of the underlying use case for this thread, but if it's about populating input options on a form, you might consider using a second object for storing these types of options. For a time, some of us were starting to use the ActionForm to represent the input options along with the input values. This notion had more to do with code maintenance than architecture. At this point, I would suggest using finely-grained DynaActionForms to represent only the input required by an action. All other constructs, like arraylists for select boxes and so forth, can be put on a second "chrome" bean. A distinct advantage here is that you can scope the chrome bean as appropriate. A global default can live in applidcation scope, and other can live in session or request scope, as appropriate to a request. HTH, Ted. Andy Schmidgall wrote: Does this mean it's impossible to do through request scope? I am attempting to do this, and it would be nice to know if my work is in vain :) -Andy -Original Message- From: Yee, Richard K,,DMDCWEST [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 10, 2003 3:20 PM To: 'Struts Users Mailing List' Subject: RE: dynamically sized form (mostly solved) I thought it worked, but it didn't. -Richard -Original Message- From: Nifty Music [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 10, 2003 1:02 PM To: [EMAIL PROTECTED] Subject: RE: dynamically sized form (mostly solved) Nicholas, What you said definitely makes sense to me. Richard graciously replied off-list with a similar response. I remember reading documentation which stated that when using dynamic arrays with DynaForms, it is necessary to place the DynaForm in session scope. However, I 'm almost positive that someone (Matt? Mark?) mentioned on this list that they were able to pass an ArrayList through a DynaForm in request scope. For a variety of reasons, I'm not too eager to put the entire formbean in the session for the sake of propogating one ArrayList attribute. If Matt or Mark or anyone else has some insights to share regarding how they were able to get this to work in request scope, I'd be very grateful to hear. Thanks again, Brent - 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]
RE: dynamically sized form (mostly solved)
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 -Original Message- From: Yee, Richard K,,DMDCWEST [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 10, 2003 4:36 PM To: 'Struts Users Mailing List' Subject: RE: dynamically sized form (mostly solved) Andy, Check out http://jakarta.apache.org/commons/collections/apidocs/org/apache/commons /col lections/decorators/LazyList.html With a lazy list, if you try and get using an index that is greater than the size of the list, then it will return an empty object instead of resulting in an ArrayIndexOutOfBounds exception. -Richard -Original Message- From: Andy Schmidgall [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 10, 2003 1:27 PM To: Struts Users Mailing List Subject: RE: dynamically sized form (mostly solved) Would someone be able to point me somewhere that could explain the LazyList? I'm having a very similar problem with my jsp, and I found the javadoc, but I don't understand how to actually instantiate the LazyList... Thanks, Andy -Original Message- From: Nicholas L Mohler [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 10, 2003 2:11 PM To: Struts Users Mailing List Subject: RE: dynamically sized form (mostly solved) The reason you get the null pointer exception is that the "inventoryList" property in your DynaActionForm is created empty. The exception occurs when Struts tries to populate inventoryList[0].startNumber or inventoryList[0].endNumber. Even though I haven't used the DynaActionForm, I know that it will have the same limitations/requirements for populating indexed properties as an ActionForm. I know that some folks use a LazyList for processing their indexed properties. Perhaps that will help you. The reason you don't get the exception with the name iList is that struts makes no attempt to populate the ArrayList in your DynaActionForm. Can't provide an answer...but I can see the why to your problem Nick "Nifty Music" <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] cc: 12/10/2003 01:33 Subject: RE: dynamically sized form (mostly solved) PM Please respond to "Struts Users Mailing List" I apologize in advance if this comes through twice. Our email server was having issues this morning, so I'm resending it in case it didn't make it out the first time. Thanks! I am attempting to do something similar to what has been posted here in the current Struts application that I'm working on. I'm using a DynaValidatorForm in request scope, iterating through a dynamically generated ArrayList that I've put into the DynaValidatorForm, and then attempting to pass it through request scope using indexed properties. The page displays perfectly, but when I try to submit it, I get the following error: [Servlet Error]-[BeanUtils.populate]: java.lang.NullPointerException: No indexed value for 'inventoryList[0]' at org.apache.struts.action.DynaActionForm.get(DynaActionForm.java:293) at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUt ils.java:474) Here are some snippets of code: >From the ActionClass that populates the .JSP: ArrayList itemRanges = itemCDTO.getItemRanges(); //returns an ArrayList of ItemRange beans form.set("inventoryList", itemRanges); From struts-config.xml: From the JSP: An interesting thing I noticed when I change the code in the JSP like this: then I don't get the error. But of course, when I do an (ArrayList) form.get("inventoryList"), it returns an empty List to the Action class. I can, however, bypass the DynaValidatorForm and directly query the HttpServletRequest object and pull the individual components by doing a request.getParameter("iList[0].startNumber"), which is extremely clunky. I'm sure I must be missing something stupid. If anyone can shed some light, it would be greatly appreciated. Thanks so much! Brent -Original Message- From: Yee, Richard K,,DMDCWEST [<mailto:[EMAIL PROTECTED]>] Sent: Friday, November 21, 2003 4:23 PM To: 'Struts Users Mailing List' Subject: RE: dynamically sized form (mostly solved) Matt, You actually only need the form in the request. You don't need the property of the form at all in your JSP. In my JSP I use In struts-config.xml I have this -Richard -Original Message- From: Matt Bathje [<mailto:[EMAIL PROTECTED]>] Sent: Friday, November 21, 2003 2:17 PM To: Struts Users Mailing List Subject: R
RE: dynamically sized form (mostly solved)
Andy, Check out http://jakarta.apache.org/commons/collections/apidocs/org/apache/commons/col lections/decorators/LazyList.html With a lazy list, if you try and get using an index that is greater than the size of the list, then it will return an empty object instead of resulting in an ArrayIndexOutOfBounds exception. -Richard -Original Message- From: Andy Schmidgall [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 10, 2003 1:27 PM To: Struts Users Mailing List Subject: RE: dynamically sized form (mostly solved) Would someone be able to point me somewhere that could explain the LazyList? I'm having a very similar problem with my jsp, and I found the javadoc, but I don't understand how to actually instantiate the LazyList... Thanks, Andy -Original Message- From: Nicholas L Mohler [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 10, 2003 2:11 PM To: Struts Users Mailing List Subject: RE: dynamically sized form (mostly solved) The reason you get the null pointer exception is that the "inventoryList" property in your DynaActionForm is created empty. The exception occurs when Struts tries to populate inventoryList[0].startNumber or inventoryList[0].endNumber. Even though I haven't used the DynaActionForm, I know that it will have the same limitations/requirements for populating indexed properties as an ActionForm. I know that some folks use a LazyList for processing their indexed properties. Perhaps that will help you. The reason you don't get the exception with the name iList is that struts makes no attempt to populate the ArrayList in your DynaActionForm. Can't provide an answer...but I can see the why to your problem Nick "Nifty Music" <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] cc: 12/10/2003 01:33 Subject: RE: dynamically sized form (mostly solved) PM Please respond to "Struts Users Mailing List" I apologize in advance if this comes through twice. Our email server was having issues this morning, so I'm resending it in case it didn't make it out the first time. Thanks! I am attempting to do something similar to what has been posted here in the current Struts application that I'm working on. I'm using a DynaValidatorForm in request scope, iterating through a dynamically generated ArrayList that I've put into the DynaValidatorForm, and then attempting to pass it through request scope using indexed properties. The page displays perfectly, but when I try to submit it, I get the following error: [Servlet Error]-[BeanUtils.populate]: java.lang.NullPointerException: No indexed value for 'inventoryList[0]' at org.apache.struts.action.DynaActionForm.get(DynaActionForm.java:293) at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUt ils.java:474) Here are some snippets of code: >From the ActionClass that populates the .JSP: ArrayList itemRanges = itemCDTO.getItemRanges(); //returns an ArrayList of ItemRange beans form.set("inventoryList", itemRanges); From struts-config.xml: From the JSP: An interesting thing I noticed when I change the code in the JSP like this: then I don't get the error. But of course, when I do an (ArrayList) form.get("inventoryList"), it returns an empty List to the Action class. I can, however, bypass the DynaValidatorForm and directly query the HttpServletRequest object and pull the individual components by doing a request.getParameter("iList[0].startNumber"), which is extremely clunky. I'm sure I must be missing something stupid. If anyone can shed some light, it would be greatly appreciated. Thanks so much! Brent -Original Message- From: Yee, Richard K,,DMDCWEST [<mailto:[EMAIL PROTECTED]>] Sent: Friday, November 21, 2003 4:23 PM To: 'Struts Users Mailing List' Subject: RE: dynamically sized form (mostly solved) Matt, You actually only need the form in the request. You don't need the property of the form at all in your JSP. In my JSP I use In struts-config.xml I have this -Richard -Original Message- From: Matt Bathje [<mailto:[EMAIL PROTECTED]>] Sent: Friday, November 21, 2003 2:17 PM To: Struts Users Mailing List Subject: Re: dynamically sized form (mostly solved) > I found out that using new DynaActionForm()inside of the > PreLoaderAction.execute() doesn't work. It gives a null pointer > exception when you try and call the set() method. > > You need to do this instead: > > FormBeanConfig cfg = mapping.getModuleConfig() > .findFormBeanConfig("dynaIndexTestForm"); >
Re: dynamically sized form (mostly solved)
No the form (to the best of my knowledge) has to scoped to session, it all looks like it works using request until you submit. IMO you're best off using standard action forms for this kinda thing dynaform get annoying for several reasons although they do work. On 10 Dec 2003, at 22:01, Andy Schmidgall wrote: Does this mean it's impossible to do through request scope? I am attempting to do this, and it would be nice to know if my work is in vain :) -Andy -Original Message- From: Yee, Richard K,,DMDCWEST [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 10, 2003 3:20 PM To: 'Struts Users Mailing List' Subject: RE: dynamically sized form (mostly solved) I thought it worked, but it didn't. -Richard -Original Message- From: Nifty Music [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 10, 2003 1:02 PM To: [EMAIL PROTECTED] Subject: RE: dynamically sized form (mostly solved) Nicholas, What you said definitely makes sense to me. Richard graciously replied off-list with a similar response. I remember reading documentation which stated that when using dynamic arrays with DynaForms, it is necessary to place the DynaForm in session scope. However, I 'm almost positive that someone (Matt? Mark?) mentioned on this list that they were able to pass an ArrayList through a DynaForm in request scope. For a variety of reasons, I'm not too eager to put the entire formbean in the session for the sake of propogating one ArrayList attribute. If Matt or Mark or anyone else has some insights to share regarding how they were able to get this to work in request scope, I'd be very grateful to hear. Thanks again, Brent - 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]
RE: dynamically sized form (mostly solved)
Does this mean it's impossible to do through request scope? I am attempting to do this, and it would be nice to know if my work is in vain :) -Andy -Original Message- From: Yee, Richard K,,DMDCWEST [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 10, 2003 3:20 PM To: 'Struts Users Mailing List' Subject: RE: dynamically sized form (mostly solved) I thought it worked, but it didn't. -Richard -Original Message- From: Nifty Music [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 10, 2003 1:02 PM To: [EMAIL PROTECTED] Subject: RE: dynamically sized form (mostly solved) Nicholas, What you said definitely makes sense to me. Richard graciously replied off-list with a similar response. I remember reading documentation which stated that when using dynamic arrays with DynaForms, it is necessary to place the DynaForm in session scope. However, I 'm almost positive that someone (Matt? Mark?) mentioned on this list that they were able to pass an ArrayList through a DynaForm in request scope. For a variety of reasons, I'm not too eager to put the entire formbean in the session for the sake of propogating one ArrayList attribute. If Matt or Mark or anyone else has some insights to share regarding how they were able to get this to work in request scope, I'd be very grateful to hear. Thanks again, Brent - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: dynamically sized form (mostly solved)
What's the problem? On 10 Dec 2003, at 21:20, Yee, Richard K,,DMDCWEST wrote: I thought it worked, but it didn't. -Richard -Original Message- From: Nifty Music [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 10, 2003 1:02 PM To: [EMAIL PROTECTED] Subject: RE: dynamically sized form (mostly solved) Nicholas, What you said definitely makes sense to me. Richard graciously replied off-list with a similar response. I remember reading documentation which stated that when using dynamic arrays with DynaForms, it is necessary to place the DynaForm in session scope. However, I 'm almost positive that someone (Matt? Mark?) mentioned on this list that they were able to pass an ArrayList through a DynaForm in request scope. For a variety of reasons, I'm not too eager to put the entire formbean in the session for the sake of propogating one ArrayList attribute. If Matt or Mark or anyone else has some insights to share regarding how they were able to get this to work in request scope, I'd be very grateful to hear. Thanks again, Brent - Original Message - From: Nicholas L Mohler <[EMAIL PROTECTED]> To: Struts Users Mailing List <[EMAIL PROTECTED]> Sent: Wednesday, December 10, 2003 2:07 PM Subject: RE: dynamically sized form (mostly solved) The reason you get the null pointer exception is that the "inventoryList" property in your DynaActionForm is created empty. The exception occurs when Struts tries to populate inventoryList[0].startNumber or inventoryList[0].endNumber. Even though I haven't used the DynaActionForm, I know that it will have the same limitations/requirements for populating indexed properties as an ActionForm. I know that some folks use a LazyList for processing their indexed properties. Perhaps that will help you. The reason you don't get the exception with the name iList is that struts makes no attempt to populate the ArrayList in your DynaActionForm. Can't provide an answer...but I can see the why to your problem Nick "Nifty Music" <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] cc: 12/10/2003 01:33 Subject: RE: dynamically sized form (mostly solved) PM Please respond to "Struts Users Mailing List" I apologize in advance if this comes through twice. Our email server was having issues this morning, so I'm resending it in case it didn't make it out the first time. Thanks! I am attempting to do something similar to what has been posted here in the current Struts application that I'm working on. I'm using a DynaValidatorForm in request scope, iterating through a dynamically generated ArrayList that I've put into the DynaValidatorForm, and then attempting to pass it through request scope using indexed properties. The page displays perfectly, but when I try to submit it, I get the following error: [Servlet Error]-[BeanUtils.populate]: java.lang.NullPointerException: No indexed value for 'inventoryList[0]' at org.apache.struts.action.DynaActionForm.get(DynaActionForm.java:293) at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyU tils. java:474) Here are some snippets of code: From the ActionClass that populates the .JSP: ArrayList itemRanges = itemCDTO.getItemRanges(); //returns an ArrayList of ItemRange beans form.set("inventoryList", itemRanges); From struts-config.xml: ="org.apache.struts.validator.DynaValidatorForm"> name="submit" type="java.lang.String" /> type="java.lang.String" /> type="java.lang.String" /> type="java.util.ArrayList" /> type="java.lang.String" /> type="gov.dor.fastr.action.inventory.InventoryModifyAction" name="inventoryModifyForm" scope="request" input="inventory.modify" validate="false"> name="page2" path="inventory.modify2" /> From the JSP: ="inventoryList" > property="startNumber" /> property="endNumber" />An interesting thing I noticed when I change the code in the JSP like this: ="inventoryList" > property="startNumber" /> property="endNumber" />...then I don't get the error. But of course, when I do an (ArrayList) form.get("inventoryList"), it returns an empty List to the Action class. I can, however, bypass the DynaValidatorForm and directly query the HttpServletRequest object and pull the individual components by doing a request.getParameter("iList[0].startNumber"), which is extremely clunky. I'm
RE: dynamically sized form (mostly solved)
Would someone be able to point me somewhere that could explain the LazyList? I'm having a very similar problem with my jsp, and I found the javadoc, but I don't understand how to actually instantiate the LazyList... Thanks, Andy -Original Message- From: Nicholas L Mohler [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 10, 2003 2:11 PM To: Struts Users Mailing List Subject: RE: dynamically sized form (mostly solved) The reason you get the null pointer exception is that the "inventoryList" property in your DynaActionForm is created empty. The exception occurs when Struts tries to populate inventoryList[0].startNumber or inventoryList[0].endNumber. Even though I haven't used the DynaActionForm, I know that it will have the same limitations/requirements for populating indexed properties as an ActionForm. I know that some folks use a LazyList for processing their indexed properties. Perhaps that will help you. The reason you don't get the exception with the name iList is that struts makes no attempt to populate the ArrayList in your DynaActionForm. Can't provide an answer...but I can see the why to your problem Nick "Nifty Music" <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] cc: 12/10/2003 01:33 Subject: RE: dynamically sized form (mostly solved) PM Please respond to "Struts Users Mailing List" I apologize in advance if this comes through twice. Our email server was having issues this morning, so I'm resending it in case it didn't make it out the first time. Thanks! I am attempting to do something similar to what has been posted here in the current Struts application that I'm working on. I'm using a DynaValidatorForm in request scope, iterating through a dynamically generated ArrayList that I've put into the DynaValidatorForm, and then attempting to pass it through request scope using indexed properties. The page displays perfectly, but when I try to submit it, I get the following error: [Servlet Error]-[BeanUtils.populate]: java.lang.NullPointerException: No indexed value for 'inventoryList[0]' at org.apache.struts.action.DynaActionForm.get(DynaActionForm.java:293) at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUt ils.java:474) Here are some snippets of code: >From the ActionClass that populates the .JSP: ArrayList itemRanges = itemCDTO.getItemRanges(); //returns an ArrayList of ItemRange beans form.set("inventoryList", itemRanges); From struts-config.xml: From the JSP: An interesting thing I noticed when I change the code in the JSP like this: then I don't get the error. But of course, when I do an (ArrayList) form.get("inventoryList"), it returns an empty List to the Action class. I can, however, bypass the DynaValidatorForm and directly query the HttpServletRequest object and pull the individual components by doing a request.getParameter("iList[0].startNumber"), which is extremely clunky. I'm sure I must be missing something stupid. If anyone can shed some light, it would be greatly appreciated. Thanks so much! Brent -Original Message- From: Yee, Richard K,,DMDCWEST [<mailto:[EMAIL PROTECTED]>] Sent: Friday, November 21, 2003 4:23 PM To: 'Struts Users Mailing List' Subject: RE: dynamically sized form (mostly solved) Matt, You actually only need the form in the request. You don't need the property of the form at all in your JSP. In my JSP I use In struts-config.xml I have this -Richard -Original Message- From: Matt Bathje [<mailto:[EMAIL PROTECTED]>] Sent: Friday, November 21, 2003 2:17 PM To: Struts Users Mailing List Subject: Re: dynamically sized form (mostly solved) > I found out that using new DynaActionForm()inside of the > PreLoaderAction.execute() doesn't work. It gives a null pointer > exception when you try and call the set() method. > > You need to do this instead: > > FormBeanConfig cfg = mapping.getModuleConfig() > .findFormBeanConfig("dynaIndexTestForm"); > DynaActionForm myForm; > Richard - this was the last piece of the puzzle for me, now it works without having to supply the name="form" on the preloader action...sweet. Mark - I have had it working both ways now, in session and request. If you want to do it in request you have to have 2 request objects in your preload. The first is the form itself, and the second is the property for the form (which is what you actually loop through in your jsp) I will probably use the request scope myself just because I tr
RE: dynamically sized form (mostly solved)
I thought it worked, but it didn't. -Richard -Original Message- From: Nifty Music [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 10, 2003 1:02 PM To: [EMAIL PROTECTED] Subject: RE: dynamically sized form (mostly solved) Nicholas, What you said definitely makes sense to me. Richard graciously replied off-list with a similar response. I remember reading documentation which stated that when using dynamic arrays with DynaForms, it is necessary to place the DynaForm in session scope. However, I 'm almost positive that someone (Matt? Mark?) mentioned on this list that they were able to pass an ArrayList through a DynaForm in request scope. For a variety of reasons, I'm not too eager to put the entire formbean in the session for the sake of propogating one ArrayList attribute. If Matt or Mark or anyone else has some insights to share regarding how they were able to get this to work in request scope, I'd be very grateful to hear. Thanks again, Brent - Original Message - From: Nicholas L Mohler <[EMAIL PROTECTED]> To: Struts Users Mailing List <[EMAIL PROTECTED]> Sent: Wednesday, December 10, 2003 2:07 PM Subject: RE: dynamically sized form (mostly solved) The reason you get the null pointer exception is that the "inventoryList" property in your DynaActionForm is created empty. The exception occurs when Struts tries to populate inventoryList[0].startNumber or inventoryList[0].endNumber. Even though I haven't used the DynaActionForm, I know that it will have the same limitations/requirements for populating indexed properties as an ActionForm. I know that some folks use a LazyList for processing their indexed properties. Perhaps that will help you. The reason you don't get the exception with the name iList is that struts makes no attempt to populate the ArrayList in your DynaActionForm. Can't provide an answer...but I can see the why to your problem Nick "Nifty Music" <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] cc: 12/10/2003 01:33 Subject: RE: dynamically sized form (mostly solved) PM Please respond to "Struts Users Mailing List" I apologize in advance if this comes through twice. Our email server was having issues this morning, so I'm resending it in case it didn't make it out the first time. Thanks! I am attempting to do something similar to what has been posted here in the current Struts application that I'm working on. I'm using a DynaValidatorForm in request scope, iterating through a dynamically generated ArrayList that I've put into the DynaValidatorForm, and then attempting to pass it through request scope using indexed properties. The page displays perfectly, but when I try to submit it, I get the following error: [Servlet Error]-[BeanUtils.populate]: java.lang.NullPointerException: No indexed value for 'inventoryList[0]' at org.apache.struts.action.DynaActionForm.get(DynaActionForm.java:293) at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtils. java:474) Here are some snippets of code: >From the ActionClass that populates the .JSP: ArrayList itemRanges = itemCDTO.getItemRanges(); //returns an ArrayList of ItemRange beans form.set("inventoryList", itemRanges); From struts-config.xml: From the JSP: An interesting thing I noticed when I change the code in the JSP like this: ...then I don't get the error. But of course, when I do an (ArrayList) form.get("inventoryList"), it returns an empty List to the Action class. I can, however, bypass the DynaValidatorForm and directly query the HttpServletRequest object and pull the individual components by doing a request.getParameter("iList[0].startNumber"), which is extremely clunky. I'm sure I must be missing something stupid. If anyone can shed some light, it would be greatly appreciated. Thanks so much! Brent -Original Message----- From: Yee, Richard K,,DMDCWEST [<mailto:[EMAIL PROTECTED]>] Sent: Friday, November 21, 2003 4:23 PM To: 'Struts Users Mailing List' Subject: RE: dynamically sized form (mostly solved
RE: dynamically sized form (mostly solved)
Nicholas, What you said definitely makes sense to me. Richard graciously replied off-list with a similar response. I remember reading documentation which stated that when using dynamic arrays with DynaForms, it is necessary to place the DynaForm in session scope. However, I 'm almost positive that someone (Matt? Mark?) mentioned on this list that they were able to pass an ArrayList through a DynaForm in request scope. For a variety of reasons, I'm not too eager to put the entire formbean in the session for the sake of propogating one ArrayList attribute. If Matt or Mark or anyone else has some insights to share regarding how they were able to get this to work in request scope, I'd be very grateful to hear. Thanks again, Brent - Original Message - From: Nicholas L Mohler <[EMAIL PROTECTED]> To: Struts Users Mailing List <[EMAIL PROTECTED]> Sent: Wednesday, December 10, 2003 2:07 PM Subject: RE: dynamically sized form (mostly solved) The reason you get the null pointer exception is that the "inventoryList" property in your DynaActionForm is created empty. The exception occurs when Struts tries to populate inventoryList[0].startNumber or inventoryList[0].endNumber. Even though I haven't used the DynaActionForm, I know that it will have the same limitations/requirements for populating indexed properties as an ActionForm. I know that some folks use a LazyList for processing their indexed properties. Perhaps that will help you. The reason you don't get the exception with the name iList is that struts makes no attempt to populate the ArrayList in your DynaActionForm. Can't provide an answer...but I can see the why to your problem Nick "Nifty Music" <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] cc: 12/10/2003 01:33 Subject: RE: dynamically sized form (mostly solved) PM Please respond to "Struts Users Mailing List" I apologize in advance if this comes through twice. Our email server was having issues this morning, so I'm resending it in case it didn't make it out the first time. Thanks! I am attempting to do something similar to what has been posted here in the current Struts application that I'm working on. I'm using a DynaValidatorForm in request scope, iterating through a dynamically generated ArrayList that I've put into the DynaValidatorForm, and then attempting to pass it through request scope using indexed properties. The page displays perfectly, but when I try to submit it, I get the following error: [Servlet Error]-[BeanUtils.populate]: java.lang.NullPointerException: No indexed value for 'inventoryList[0]' at org.apache.struts.action.DynaActionForm.get(DynaActionForm.java:293) at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtils.java:474) Here are some snippets of code: >From the ActionClass that populates the .JSP: ArrayList itemRanges = itemCDTO.getItemRanges(); //returns an ArrayList of ItemRange beans form.set("inventoryList", itemRanges); >From struts-config.xml: >From the JSP: An interesting thing I noticed when I change the code in the JSP like this: ...then I don't get the error. But of course, when I do an (ArrayList) form.get("inventoryList"), it returns an empty List to the Action class. I can, however, bypass the DynaValidatorForm and directly query the HttpServletRequest object and pull the individual components by doing a request.getParameter("iList[0].startNumber"), which is extremely clunky. I'm sure I must be missing something stupi
RE: dynamically sized form (mostly solved)
The reason you get the null pointer exception is that the "inventoryList" property in your DynaActionForm is created empty. The exception occurs when Struts tries to populate inventoryList[0].startNumber or inventoryList[0].endNumber. Even though I haven't used the DynaActionForm, I know that it will have the same limitations/requirements for populating indexed properties as an ActionForm. I know that some folks use a LazyList for processing their indexed properties. Perhaps that will help you. The reason you don't get the exception with the name iList is that struts makes no attempt to populate the ArrayList in your DynaActionForm. Can't provide an answer...but I can see the why to your problem Nick "Nifty Music" <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] cc: 12/10/2003 01:33 Subject: RE: dynamically sized form (mostly solved) PM Please respond to "Struts Users Mailing List" I apologize in advance if this comes through twice. Our email server was having issues this morning, so I'm resending it in case it didn't make it out the first time. Thanks! I am attempting to do something similar to what has been posted here in the current Struts application that I'm working on. I'm using a DynaValidatorForm in request scope, iterating through a dynamically generated ArrayList that I've put into the DynaValidatorForm, and then attempting to pass it through request scope using indexed properties. The page displays perfectly, but when I try to submit it, I get the following error: [Servlet Error]-[BeanUtils.populate]: java.lang.NullPointerException: No indexed value for 'inventoryList[0]' at org.apache.struts.action.DynaActionForm.get(DynaActionForm.java:293) at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtils.java:474) Here are some snippets of code: >From the ActionClass that populates the .JSP: ArrayList itemRanges = itemCDTO.getItemRanges(); //returns an ArrayList of ItemRange beans form.set("inventoryList", itemRanges); >From struts-config.xml: >From the JSP: An interesting thing I noticed when I change the code in the JSP like this: then I don't get the error. But of course, when I do an (ArrayList) form.get("inventoryList"), it returns an empty List to the Action class. I can, however, bypass the DynaValidatorForm and directly query the HttpServletRequest object and pull the individual components by doing a request.getParameter("iList[0].startNumber"), which is extremely clunky. I'm sure I must be missing something stupid. If anyone can shed some light, it would be greatly appreciated. Thanks so much! Brent -Original Message- From: Yee, Richard K,,DMDCWEST [<mailto:[EMAIL PROTECTED]>] Sent: Friday, November 21, 2003 4:23 PM To: 'Struts Users Mailing List' Subject: RE: dynamically sized form (mostly solved) Matt, You actually only need the form in the request. You don't need the property of the form at all in your JSP. In my JSP I use In struts-config.xml I have this -Richard -Original Message----- From: Matt Bathje [<mailto:[EMAIL PROTECTED]>] Sent: Friday, November 21, 2003 2:17 PM To: Struts Users Mailing List Subject: Re: dynamically sized form (mostly solved) > I found out that using new DynaActionForm()inside of the > PreLoaderAction.execute() doesn't work. It gives a null pointer > exception when you try and call the set() method. > > You need to do this instead: > > FormBeanConfig cfg = mapping.getM
RE: dynamically sized form (mostly solved)
I apologize in advance if this comes through twice. Our email server was having issues this morning, so I'm resending it in case it didn't make it out the first time. Thanks! I am attempting to do something similar to what has been posted here in the current Struts application that I'm working on. I'm using a DynaValidatorForm in request scope, iterating through a dynamically generated ArrayList that I've put into the DynaValidatorForm, and then attempting to pass it through request scope using indexed properties. The page displays perfectly, but when I try to submit it, I get the following error: [Servlet Error]-[BeanUtils.populate]: java.lang.NullPointerException: No indexed value for 'inventoryList[0]' at org.apache.struts.action.DynaActionForm.get(DynaActionForm.java:293) at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtils.java:474) Here are some snippets of code: >From the ActionClass that populates the .JSP: ArrayList itemRanges = itemCDTO.getItemRanges(); //returns an ArrayList of ItemRange beans form.set("inventoryList", itemRanges); >From struts-config.xml: >From the JSP: An interesting thing I noticed when I change the code in the JSP like this: then I don't get the error. But of course, when I do an (ArrayList) form.get("inventoryList"), it returns an empty List to the Action class. I can, however, bypass the DynaValidatorForm and directly query the HttpServletRequest object and pull the individual components by doing a request.getParameter("iList[0].startNumber"), which is extremely clunky. I'm sure I must be missing something stupid. If anyone can shed some light, it would be greatly appreciated. Thanks so much! Brent -Original Message- From: Yee, Richard K,,DMDCWEST [<mailto:[EMAIL PROTECTED]>] Sent: Friday, November 21, 2003 4:23 PM To: 'Struts Users Mailing List' Subject: RE: dynamically sized form (mostly solved) Matt, You actually only need the form in the request. You don't need the property of the form at all in your JSP. In my JSP I use In struts-config.xml I have this -Richard -Original Message- From: Matt Bathje [<mailto:[EMAIL PROTECTED]>] Sent: Friday, November 21, 2003 2:17 PM To: Struts Users Mailing List Subject: Re: dynamically sized form (mostly solved) > I found out that using new DynaActionForm()inside of the > PreLoaderAction.execute() doesn't work. It gives a null pointer > exception when you try and call the set() method. > > You need to do this instead: > > FormBeanConfig cfg = mapping.getModuleConfig() > .findFormBeanConfig("dynaIndexTestForm"); > DynaActionForm myForm; > Richard - this was the last piece of the puzzle for me, now it works without having to supply the name="form" on the preloader action...sweet. Mark - I have had it working both ways now, in session and request. If you want to do it in request you have to have 2 request objects in your preload. The first is the form itself, and the second is the property for the form (which is what you actually loop through in your jsp) I will probably use the request scope myself just because I try to stay out of session as much as possible. Thanks, Matt Bathje - 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] 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]
Re: dynamically sized form (mostly solved)
Submit the form.. And then perhaps the penny might drop But perhaps not.. On 21 Nov 2003, at 23:42, Yee, Richard K,,DMDCWEST wrote: Mark, What are you trying to tell us? Do you think it is a bad practice to pre-load a form in an action by instantiating the formBean in the action? Or is it something else that you find objectionable? -Richard -Original Message- From: Mark Lowe [mailto:[EMAIL PROTECTED] Sent: Friday, November 21, 2003 3:38 PM To: Struts Users Mailing List Subject: Re: dynamically sized form (mostly solved) Dick Oh well... There's just no telling some folks.. [OT] But then I've just seen who you're working for.. Sleep well.. - 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]
RE: dynamically sized form (mostly solved)
Mark, What are you trying to tell us? Do you think it is a bad practice to pre-load a form in an action by instantiating the formBean in the action? Or is it something else that you find objectionable? -Richard -Original Message- From: Mark Lowe [mailto:[EMAIL PROTECTED] Sent: Friday, November 21, 2003 3:38 PM To: Struts Users Mailing List Subject: Re: dynamically sized form (mostly solved) Dick Oh well... There's just no telling some folks.. [OT] But then I've just seen who you're working for.. Sleep well.. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: dynamically sized form (mostly solved)
Dick Oh well... There's just no telling some folks.. [OT] But then I've just seen who you're working for.. Sleep well.. On 21 Nov 2003, at 21:04, Yee, Richard K,,DMDCWEST wrote: Matt, I found out that using new DynaActionForm()inside of the PreLoaderAction.execute() doesn't work. It gives a null pointer exception when you try and call the set() method. You need to do this instead: FormBeanConfig cfg = mapping.getModuleConfig() .findFormBeanConfig("dynaIndexTestForm"); DynaActionForm myForm; try { myForm = (DynaActionForm) DynaActionFormClass.createDynaActionFormClass(cfg) .newInstance(); } catch (InstantiationException ie) { // return mapping.findForward(MyConstants.CONFIG_ERROR_FORWARD); } catch (IllegalAccessException iae) { return mapping.findForward(MyConstants.CONFIG_ERROR_FORWARD); } myForm.set("tests", tests); request.setAttribute("dynaIndexTestForm", myForm); return mapping.findForward("success"); That being said, I'll admit that it's not the cleanest bunch of code, but it enables you to create your DynaForm in an action that has a different ActionForm or DynaActionForm set as the value of the 'name' attribute of the action mapping. Otherwise, if you need to do this, you would have to forward to the action that performs the pre-loading (a chained action). You don't need to put anything in session scope. -Richard -Original Message- From: Matt Bathje [mailto:[EMAIL PROTECTED] Sent: Friday, November 21, 2003 10:29 AM To: Struts Users Mailing List Subject: Re: dynamically sized form (mostly solved) DynaActionForm taxRatesForm = new DynaActionForm(); and taxRatesForm.set("taxRates", allTaxRates); request.setAttribute("taxRates", allTaxRates); Creating a form in the action servlet is one sure way to piss the folks off who have to maintain the app. You might think its big n clever, but you'd be hiding the form away in a class, what do the htmlists do? Well this does not work for me anyway. When I change the code to do what Richard suggests, I get null pointer exceptions. So is what you are saying Mark is that the way I am doing this (have the form name specified on the preloader action, and do DynaActionForm taxRateForm = (DynaActionForm) form; in the preloader action class) is correct? Using arraylist means you dont have to use the lazy list initialization that i think that using an array will require. See bean utils for details. I could be full of shit but I have this working with arrayList and no joy with using arrays of beans. It is working fine for me with an array of beans. I'm not entirely sure what you mean by lazy list initalization, or how it could be a problem here. (I couldn't find a reference in the BeanUtils api, and googling for it didn't return much other than standard java lazy instantiation which from my Java knowledge isn't a problem...) I think you have the choice of putting the form in either session or request scope. Request scope is generally preferable b/c the memory gets released sooner. Yeah right .. Nullpointerexception tastic. Last I looked scoping to request wont work , so don't bother. My form is in the request scope and working fine. I agree with Richard in preferring request scope, but if there is a valid reason for it to be in session instead I'd move it there. Matt Bathje - 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]
Re: dynamically sized form (mostly solved)
Cool, thanks for the extra tip! Matt Bathje - Original Message - From: "Yee, Richard K,,DMDCWEST" <[EMAIL PROTECTED]> To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]> Sent: Friday, November 21, 2003 4:22 PM Subject: RE: dynamically sized form (mostly solved) > Matt, > You actually only need the form in the request. You don't need the property > of the form at all in your JSP. > > In my JSP I use > > > indexId="ctr" > > > > > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: dynamically sized form (mostly solved)
Matt, You actually only need the form in the request. You don't need the property of the form at all in your JSP. In my JSP I use In struts-config.xml I have this -Richard -Original Message- From: Matt Bathje [mailto:[EMAIL PROTECTED] Sent: Friday, November 21, 2003 2:17 PM To: Struts Users Mailing List Subject: Re: dynamically sized form (mostly solved) > I found out that using new DynaActionForm()inside of the > PreLoaderAction.execute() doesn't work. It gives a null pointer > exception when you try and call the set() method. > > You need to do this instead: > > FormBeanConfig cfg = mapping.getModuleConfig() >.findFormBeanConfig("dynaIndexTestForm"); > DynaActionForm myForm; > Richard - this was the last piece of the puzzle for me, now it works without having to supply the name="form" on the preloader action...sweet. Mark - I have had it working both ways now, in session and request. If you want to do it in request you have to have 2 request objects in your preload. The first is the form itself, and the second is the property for the form (which is what you actually loop through in your jsp) I will probably use the request scope myself just because I try to stay out of session as much as possible. Thanks, Matt Bathje - 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]
Re: dynamically sized form (mostly solved)
> I found out that using new DynaActionForm()inside of the > PreLoaderAction.execute() doesn't work. It gives a null pointer exception > when you try and call the set() method. > > You need to do this instead: > > FormBeanConfig cfg = mapping.getModuleConfig() >.findFormBeanConfig("dynaIndexTestForm"); > DynaActionForm myForm; > Richard - this was the last piece of the puzzle for me, now it works without having to supply the name="form" on the preloader action...sweet. Mark - I have had it working both ways now, in session and request. If you want to do it in request you have to have 2 request objects in your preload. The first is the form itself, and the second is the property for the form (which is what you actually loop through in your jsp) I will probably use the request scope myself just because I try to stay out of session as much as possible. Thanks, Matt Bathje - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: dynamically sized form (mostly solved)
Matt, I found out that using new DynaActionForm()inside of the PreLoaderAction.execute() doesn't work. It gives a null pointer exception when you try and call the set() method. You need to do this instead: FormBeanConfig cfg = mapping.getModuleConfig() .findFormBeanConfig("dynaIndexTestForm"); DynaActionForm myForm; try { myForm = (DynaActionForm) DynaActionFormClass.createDynaActionFormClass(cfg) .newInstance(); } catch (InstantiationException ie) { // return mapping.findForward(MyConstants.CONFIG_ERROR_FORWARD); } catch (IllegalAccessException iae) { return mapping.findForward(MyConstants.CONFIG_ERROR_FORWARD); } myForm.set("tests", tests); request.setAttribute("dynaIndexTestForm", myForm); return mapping.findForward("success"); That being said, I'll admit that it's not the cleanest bunch of code, but it enables you to create your DynaForm in an action that has a different ActionForm or DynaActionForm set as the value of the 'name' attribute of the action mapping. Otherwise, if you need to do this, you would have to forward to the action that performs the pre-loading (a chained action). You don't need to put anything in session scope. -Richard -Original Message- From: Matt Bathje [mailto:[EMAIL PROTECTED] Sent: Friday, November 21, 2003 10:29 AM To: Struts Users Mailing List Subject: Re: dynamically sized form (mostly solved) > > DynaActionForm taxRatesForm = new DynaActionForm(); > > and > > taxRatesForm.set("taxRates", allTaxRates); > > request.setAttribute("taxRates", > > allTaxRates); > > Creating a form in the action servlet is one sure way to piss the > folks > off who have to maintain the app. You might think its big n clever, but > you'd be hiding the form away in a class, what do the htmlists do? Well this does not work for me anyway. When I change the code to do what Richard suggests, I get null pointer exceptions. So is what you are saying Mark is that the way I am doing this (have the form name specified on the preloader action, and do DynaActionForm taxRateForm = (DynaActionForm) form; in the preloader action class) is correct? > > > Using arraylist means you dont have to use the lazy list > initialization > that i think that using an array will require. See bean utils for > details. I could be full of shit but I have this working with arrayList > and no joy with using arrays of beans. > It is working fine for me with an array of beans. I'm not entirely sure what you mean by lazy list initalization, or how it could be a problem here. (I couldn't find a reference in the BeanUtils api, and googling for it didn't return much other than standard java lazy instantiation which from my Java knowledge isn't a problem...) > > I think you have the choice of putting the form in either session or > > request > > scope. Request scope is generally preferable b/c the memory gets > > released > > sooner. > > Yeah right .. Nullpointerexception tastic. Last I looked scoping to > request wont work , so don't bother. My form is in the request scope and working fine. I agree with Richard in preferring request scope, but if there is a valid reason for it to be in session instead I'd move it there. Matt Bathje - 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]
Re: dynamically sized form (mostly solved)
On 21 Nov 2003, at 18:29, Matt Bathje wrote: DynaActionForm taxRatesForm = new DynaActionForm(); and taxRatesForm.set("taxRates", allTaxRates); request.setAttribute("taxRates", allTaxRates); Creating a form in the action servlet is one sure way to piss the folks off who have to maintain the app. You might think its big n clever, but you'd be hiding the form away in a class, what do the htmlists do? Well this does not work for me anyway. When I change the code to do what Richard suggests, I get null pointer exceptions. So is what you are saying Mark is that the way I am doing this (have the form name specified on the preloader action, and do DynaActionForm taxRateForm = (DynaActionForm) form; in the preloader action class) is correct? Yep Using arraylist means you dont have to use the lazy list initialization that i think that using an array will require. See bean utils for details. I could be full of shit but I have this working with arrayList and no joy with using arrays of beans. It is working fine for me with an array of beans. I'm not entirely sure what you mean by lazy list initalization, or how it could be a problem here. (I couldn't find a reference in the BeanUtils api, and googling for it didn't return much other than standard java lazy instantiation which from my Java knowledge isn't a problem...) Could be true.. I've had it working with arraylist, if it works as an array i;d like to know. I think you have the choice of putting the form in either session or request scope. Request scope is generally preferable b/c the memory gets released sooner. Yeah right .. Nullpointerexception tastic. Last I looked scoping to request wont work , so don't bother. My form is in the request scope and working fine. I agree with Richard in preferring request scope, but if there is a valid reason for it to be in session instead I'd move it there. If your dynamically changing the size of the array.. I doubt it, unless somethings been fixed.. Submit the form before you assume it works fine.. If it still works then great.. Cheers Mark Matt Bathje - 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]
Re: dynamically sized form (mostly solved)
> > DynaActionForm taxRatesForm = new DynaActionForm(); > > and > > taxRatesForm.set("taxRates", allTaxRates); > > request.setAttribute("taxRates", > > allTaxRates); > > Creating a form in the action servlet is one sure way to piss the folks > off who have to maintain the app. You might think its big n clever, but > you'd be hiding the form away in a class, what do the htmlists do? Well this does not work for me anyway. When I change the code to do what Richard suggests, I get null pointer exceptions. So is what you are saying Mark is that the way I am doing this (have the form name specified on the preloader action, and do DynaActionForm taxRateForm = (DynaActionForm) form; in the preloader action class) is correct? > > > Using arraylist means you dont have to use the lazy list initialization > that i think that using an array will require. See bean utils for > details. I could be full of shit but I have this working with arrayList > and no joy with using arrays of beans. > It is working fine for me with an array of beans. I'm not entirely sure what you mean by lazy list initalization, or how it could be a problem here. (I couldn't find a reference in the BeanUtils api, and googling for it didn't return much other than standard java lazy instantiation which from my Java knowledge isn't a problem...) > > I think you have the choice of putting the form in either session or > > request > > scope. Request scope is generally preferable b/c the memory gets > > released > > sooner. > > Yeah right .. Nullpointerexception tastic. Last I looked scoping to > request wont work , so don't bother. My form is in the request scope and working fine. I agree with Richard in preferring request scope, but if there is a valid reason for it to be in session instead I'd move it there. Matt Bathje - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: dynamically sized form (mostly solved)
On 21 Nov 2003, at 17:18, Yee, Richard K,,DMDCWEST wrote: Matt, The answer to your main question is, "No". You don't have to specify the form as the input of the preloader. You don't even really have to have a separate 'pre-loader' action for this form. In any action that will forward to your JSP page that displays your form, you can create a new form using: DynaActionForm taxRatesForm = new DynaActionForm(); and taxRatesForm.set("taxRates", allTaxRates); request.setAttribute("taxRates", allTaxRates); Creating a form in the action servlet is one sure way to piss the folks off who have to maintain the app. You might think its big n clever, but you'd be hiding the form away in a class, what do the htmlists do? Using arraylist means you dont have to use the lazy list initialization that i think that using an array will require. See bean utils for details. I could be full of shit but I have this working with arrayList and no joy with using arrays of beans. DynaActionForm theForm = (DynaActionForm) form; ArrayList rateList = new ArrayList(); Iterator it = getSomeStuffFromMyModel(); while(it.hasMoreElements()) { rateList.add(it.next()); } theForm.set("taxRate",rateList); request.setAttribute("taxRate",rateList); This will prepopulate the the array and put the form in the request. Specifying the name="formName" in the action will just give you the form as the parameter to the execute method. The alternative is to create it yourself with 'new'. I think you have the choice of putting the form in either session or request scope. Request scope is generally preferable b/c the memory gets released sooner. Yeah right .. Nullpointerexception tastic. Last I looked scoping to request wont work , so don't bother. I'm not clear on the need to put allTaxRates in session scope. Can you send your JSP code? I think I've posted this about 60,000 times in just a matter of months so i guess one more wont hurt. Cheers Mark -Richard -Original Message- From: Matt Bathje [mailto:[EMAIL PROTECTED] Sent: Friday, November 21, 2003 7:37 AM To: Struts Users Mailing List Subject: Re: dynamically sized form (mostly solved) Might I say - woohoo!! Thanks to your guys help, I got this working. I just want to make sure that I'm doing this the best way. In my struts-config file, the preloader has to have the form named in addition to having it on the action. The form is setup to be in the request scope, not in the session scope. In my preloader action, instead of doing DynaActionForm taxRatesForm = new DynaActionForm(); I do: DynaActionForm taxRatesForm = (DynaActionForm) form; then I just do: taxRatesForm.set("taxRates", allTaxRates); request.setAttribute("taxRates", allTaxRates); In the submit action, I just have to do: DynaActionForm taxRatesForm = (DynaActionForm) form; TaxRateBean[] taxRates = (TaxRateBean[]) taxRateForm.get("taxRates"); Everything seems to work pretty slickly. My main question is if having to have the name="formName" in the preloader action is correct? It would be nice to know if I am doing anything else the "incorrect" way though also. If I didn't explain anything very well and you want to see code snippets, just let me know. Thanks, Matt - 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]
RE: dynamically sized form (mostly solved)
Matt, The answer to your main question is, "No". You don't have to specify the form as the input of the preloader. You don't even really have to have a separate 'pre-loader' action for this form. In any action that will forward to your JSP page that displays your form, you can create a new form using: DynaActionForm taxRatesForm = new DynaActionForm(); and taxRatesForm.set("taxRates", allTaxRates); request.setAttribute("taxRates", allTaxRates); This will prepopulate the the array and put the form in the request. Specifying the name="formName" in the action will just give you the form as the parameter to the execute method. The alternative is to create it yourself with 'new'. I think you have the choice of putting the form in either session or request scope. Request scope is generally preferable b/c the memory gets released sooner. I'm not clear on the need to put allTaxRates in session scope. Can you send your JSP code? -Richard -Original Message- From: Matt Bathje [mailto:[EMAIL PROTECTED] Sent: Friday, November 21, 2003 7:37 AM To: Struts Users Mailing List Subject: Re: dynamically sized form (mostly solved) Might I say - woohoo!! Thanks to your guys help, I got this working. I just want to make sure that I'm doing this the best way. In my struts-config file, the preloader has to have the form named in addition to having it on the action. The form is setup to be in the request scope, not in the session scope. In my preloader action, instead of doing DynaActionForm taxRatesForm = new DynaActionForm(); I do: DynaActionForm taxRatesForm = (DynaActionForm) form; then I just do: taxRatesForm.set("taxRates", allTaxRates); request.setAttribute("taxRates", allTaxRates); In the submit action, I just have to do: DynaActionForm taxRatesForm = (DynaActionForm) form; TaxRateBean[] taxRates = (TaxRateBean[]) taxRateForm.get("taxRates"); Everything seems to work pretty slickly. My main question is if having to have the name="formName" in the preloader action is correct? It would be nice to know if I am doing anything else the "incorrect" way though also. If I didn't explain anything very well and you want to see code snippets, just let me know. Thanks, Matt - 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]
Re: dynamically sized form (mostly solved)
Might I say - woohoo!! Thanks to your guys help, I got this working. I just want to make sure that I'm doing this the best way. In my struts-config file, the preloader has to have the form named in addition to having it on the action. The form is setup to be in the request scope, not in the session scope. In my preloader action, instead of doing DynaActionForm taxRatesForm = new DynaActionForm(); I do: DynaActionForm taxRatesForm = (DynaActionForm) form; then I just do: taxRatesForm.set("taxRates", allTaxRates); request.setAttribute("taxRates", allTaxRates); In the submit action, I just have to do: DynaActionForm taxRatesForm = (DynaActionForm) form; TaxRateBean[] taxRates = (TaxRateBean[]) taxRateForm.get("taxRates"); Everything seems to work pretty slickly. My main question is if having to have the name="formName" in the preloader action is correct? It would be nice to know if I am doing anything else the "incorrect" way though also. If I didn't explain anything very well and you want to see code snippets, just let me know. Thanks, Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]