Arron, Thanks for responding.
Things seem to be clearer now. I have a question to ask though. We all know Bananas have seeds. (So a BananaBean can have a collection of seeds.) Now I have a situation where I have to set the property of the seed bean via the JSP on submit. Lets have a seed bean public class SeedBean { public String getColor() { return color; } public void setColor(String str) { color= str; } private String color; } Now in the MonkeyBean (Which is the formbean ) can I say the following? public class MonkeyBean { public List getBananas() { return bananas; } private List bananas = LazyCollections.lazyList(new ArrayList(LazyCollections.lazyList(new ArrayList(), SeedBean.class)), BananaBean.class); } I tried doing the same but it didnt work :( Thanks for your time hemant ----- Original Message ----- From: "Arron Bates" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Tuesday, July 23, 2002 10:19 AM Subject: Re: Wrapping Collections in LazyList to auto-populate form on Submit > Hemant, > > Sorry about the issues you're having, but at face value it seems that > you're almost trying too hard. Without seeing the rest of your code, > it's hard to see what your generateWrappedCollection() method is trying > to acheive, so I'll try to answer with code... > > > With the collection wrapping, it's a simple one liner in the bean. For > example, in all my monkey examples, they all return the collection as > the indexed property type (because it's a valid indexed getter and the > iterate tags can use the collection to get their thing going). All you > need to do is wrap that collection directly. > > > For example, two complete beans... > > public class MonkeyBean { > public List getBananas() { return bananas; } > private List bananas = LazyCollections.lazyList(new ArrayList(), > BananaBean.class); > } > > public class BananaBean { > public String getFlavour() { return flav; } > public void setFlavour(String str) { flav = str; } > private String flav; > } > > > > The MonkeyBean is the parent class that hold the collection. It has > immediately wrapped the ArrayList in the LazyCollection, and passed it > the class of the BananaBean object. You may want to keep a reference to > the wrapped ArrayList, generally I don't have the need to. > > These classes are all but ready to rock. In the action class, query the > database or whatever and populate the MonkeyBean with the BananaBean > data. Serve the result to the JSP. > > JSP write out a list of text boxes using iterate tags. Submit this, and > after the monkeybean is built, the lazy collection will grow the banana > list with banana beans as the indexed requests come in. > > When it gets back to your action class, you'll have your collection of > banana beans. > > Hope this helps, you know where we are if it doesn't. > > > Arron. > > > > On Mon, 2002-07-22 at 22:59, hemant wrote: > > Comrades, > > > > > > Objective: To autopopulate forms on submit. The formbean "has a" collection of collections of ValueObjects. Each valueObject contains a pair of other Value Objects. > > > > Before people beat me up, The following possibilities have been dealt with: > > > > 1>> No, this is not a case of reset() I have the collections initialized and things are fine. > > > > 2>> It is not a case of bean being in request scope. By default the bean is in session scope (Unless we explicitly mention the action attribute that it is request scope.) > > [ ...cut...] > > > > > I am about to give up on form auto populate as I am out of time. I will be populating them by hand but anyway... one last attempt. We dont like to lose... do we? > > > > > > > > Thanks In Advance > > > > hemant > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>