You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Je...@nlgroup.ca on 2002/10/19 23:39:56 UTC

Re: [LazyCollections] Anyone else using this? - Found some answers....LazyCollections gone

I managed to make my issues go away by replacing my
commons-collections(2.0)  jar with the Release Candidate 2.1 version.

It also seems that some of the functionality of LazyCollections has been
absorbed into ListUtils.

so I replaced
private List papVoList = LazyCollections.lazyList(new ArrayList
(),PapVoViewBean.class)

with:
private List papVoList = ListUtils.lazyList(new ArrayList(),
        new Factory(){
            public Object create(){
                return new PapVoViewBean();
            }
        });

It appears to work, so I am happy :)

I peeked into the struts nightly binary and it appears that
commons-collection 2.1 is what is shipped.

QUESTION:
Is it safe to replace the commons-collection 2.0  jar with 2.1 at this
time? or should I wait.

Is there another way to get this functionality without upsetting our
release packages?







Jeff_Mychasiw@nlgroup.ca on 10/19/2002 01:01:01 PM

Please respond to "Struts Users Mailing List"
       <st...@jakarta.apache.org>

To:    struts-user@jakarta.apache.org
cc:

Subject:    [LazyCollections] Anyone else using this?


Greetings:
      I am just starting to use this Class from commons.collections jar
that is in Struts 1.1b2 ( I am using tomcat 4.04)

I have several questions...

1- Is there anyone out there using this collection that can share some
insight?
2 - There was talk of a tutorial regarding this utility, but I cannot find
one in jakarta commons or keyboardmonkey.com.
 Does one exist? I have read (I think) all the posts in the archive
regarding this.

3 -  I am in the process of implementing a standard dynamic list of value
objects on a page that have several columns that are editable.
    I have it working for the most part but I have one *odd* issue.
When I submit the form, the list gets populated as it should but with one
extra value bean.

USAGE:
My form Bean contains the  property:
private List papVoList = LazyCollections.lazyList(new ArrayList
(),PapVoViewBean.class);

 I use the nested tags to render the table on the page.

In my loadAction I send a standard java.util.List from the backend (which
is probably a Vector);
List myList = businessService.getPapVoList();
myForm.setPapVoList(myList);
*** By doing this I guess the initialized LazyList in the form bean is
replaced with a standard List just for the loading of the page.
but when the form is submitted, I assume a new request scope form bean is
created. ( if not the list would not be populated at all)

Am I setting things up correctly?

Sorry for the Rambling, but here are some of the things I have observed:

A list of 20 goes onto the page and a list of 21 get created upon submit.
** The new** object has property with a value from the last legitimate
object in the list. Example:

vo[0]: amount=111 ,date=111
vo[1]: amount=222,date=222
...
vo[19]: amount=999,date=999
vo[20]: amount=999,date=null  (Extra object)
I do not understand why amt has a value but date does not.

I have verified that the control names are correct on the page . Example:
FROM papVoList[0].papDate    TO  papVoList[19].papDate  and no more.
I have printed the parameter names and values directly from the request and
found no stray parameters.

Another odd thing is that I tried to use the LazyCollections.clean(List)
 method(I didn't think I would need to) ,
 it would produce yet another blank object to end of the list.

List myList = myForm.getMyList();
myList.size(): 21
LazyCollections.clean(myList)
myList.size(): 22




--
To unsubscribe, e-mail:   <
mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <
mailto:struts-user-help@jakarta.apache.org>








--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>