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]>

Reply via email to