I have not understood your problem completely.

But this looks like more a problem of resetting the list in form than anything else.

Firstly, if you are using request scoped form, then why going from page 1 to page 2 
will apend the beans to form?

Are you sure you are using request scoped forms?

If the form is session scoped, make sure you reset the list to empty properly.

HTH.
regards,
Shirish

-----Original Message-----
From: Martin Sturzenegger [mailto:[EMAIL PROTECTED]
Sent: Friday, February 27, 2004 3:28 PM
To: Struts Users Mailing List
Subject: RE: Problem in nested tags- Very Urgent - Please Help


hi,
i'm trying to use hubert's (and shirish's) approach on request-scope, and as long as 
the amount of rows are fixed it works well.
BUT now i have an additional feature on my page and that gives me headaches. 
actionOne gets the rows from the dto-bean and initializes the jsp. 
on the jsp-page with the form over the rows, i have an additional form where the user 
can toggle through different versions of my db.
this form submits to actionOne where the action is supposed to fetch another set of 
rows, according to the parameter given. 
let's say: choose february 12th there are 12 rows to display, choose february 15th 
there are 15 different rows, choose the next day there are 10 rows.
with this approach, starting with february 12th i get 12 rows. changing to february 
15th i get the old 12 rows and the new 15 rows added to, going back to feb 12th i get 
the old 27 rows and again the 12 rows from feb.12 added to and so on and on....
is there a way to reinitialize the autopopulation method or even to temporarily 
disable autopopulation on lists with nested properties?
any adwise or code snippets are warmly welcomed
take care
martin



---------- Urspruengliche Nachricht ------------------------------
Von: Hubert Rabago <[EMAIL PROTECTED]>
Antworten an: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Datum:  Thu, 26 Feb 2004 07:01:54 -0800 (PST)

>IIRC, you also need it in reset():
>
>public class LazyListExampleForm extends ActionForm {
>    private List actionList;
> 
>    public LazyListExampleForm () {
>        initLists();
>    }
>
>    public void reset(ActionMapping mapping, 
>                      HttpServletRequest request) {
>        super.reset(mapping, request);
>        initLists();
>    }
> 
>    private void initLists() {
>        Factory factory = new Factory() {
>            public Object create() {
>                return new ActionListBean();
>            }
>        };
>        this.actionList = ListUtils.lazyList(new ArrayList(), factory);
>    }
>
>    // Getter/setters for list omitted
>}
>
>- Hubert
>
>--- "Paul, R. Chip" <[EMAIL PROTECTED]> wrote:
>> Note: I think this is likely different in current versions of the commons
>> collections lib, but this works for the version we are dependent on.
>> 
>> import java.util.ArrayList;
>> import java.util.List;
>> import org.apache.commons.collections.Factory;
>> import org.apache.commons.collections.ListUtils;
>> // Nonrelevant imports ommitted
>> 
>> public class LazyListExampleForm extends ActionForm {
>>      private List actionList;
>> 
>>      public LazyListExampleForm ()
>>      {
>>              Factory factory = new Factory() {
>>                   public Object create() {
>>                       return new ActionListBean();
>>                   }
>>               };
>>               this.actionList = ListUtils.lazyList(new ArrayList(),
>> factory);
>>      }
>> 
>>      // Getter/setters for list omitted
>> }
>> 
>> -----Original Message-----
>> From: Mark Lowe [mailto:[EMAIL PROTECTED] 
>> Sent: Thursday, February 26, 2004 8:49 AM
>> To: Struts Users Mailing List
>> Subject: Re: Problem in nested tags- Very Urgent - Please Help
>> 
>> 
>> wouldn't mind an example of how to use lazy list if you have one.
>> 
>> 
>> On 26 Feb 2004, at 15:33, Paul, R. Chip wrote:
>> 
>> > Or use the Commons Collections LazyList which handles this problem 
>> > automatically.
>> >
>> > -----Original Message-----
>> > From: Mark Lowe [mailto:[EMAIL PROTECTED]
>> > Sent: Thursday, February 26, 2004 8:09 AM
>> > To: Struts Users Mailing List
>> > Subject: Re: Problem in nested tags- Very Urgent - Please Help
>> >
>> >
>> > shirish posted this a few times.
>> >
>> > if you're scoping to request you'll need a while loop in your 
>> > getFoo(int index)  method
>> >
>> > public class OrgManagementForm extends ActionForm {
>> >
>> > private List addressList = new ArrayList();
>> >
>> > public Address getAddress(int index) {
>> >    
>> >    while(index >= addressList.size() ) {
>> >            this.addressList.add( new Address() );
>> >    }
>> >
>> >    return (Address) addressList.get(index);
>> > }
>> >
>> > bla bla.
>> >
>> > }
>> >
>> > look like it could be your problem.
>> >
>> >
>> > On 26 Feb 2004, at 14:57, Parthasarathy Kesavaraj wrote:
>> >
>> >> I am having an OrganzationVO inside my form-bean.
>> >>
>> >> The OrganzationVO has a collection of AddressVOs.
>> >>
>> >> I am using nested tags like this.
>> >>
>> >>
>> >> <nested:nest property = "orgVO">
>> >>
>> >>   <nested:text property="orgID"  size="10" maxlength="10"
>> >> styleClass="inputmand"    tabindex="" />
>> >>           
>> >>   <nested:iterate id="addressid" property="addresses" indexId="index">
>> >>
>> >>   
>> >> <nested:text property="company1" size="30" maxlength="30" 
>> >> styleClass="inputmand" tabindex="" />
>> >>   
>> >>   </nested:iterate>
>> >>
>> >> </nested:nest>
>> >>
>> >> while submitting the form I am getting an exception like this.
>> >>
>> >>
>> >> 2004-02-26 18:17:08,133 [ExecuteThread: '12' for queue: 
>> >> 'weblogic.kernel.Default'] DEBUG org.apache. 
>> >> commons.beanutils.BeanUtils - 
>> >> setProperty([EMAIL PROTECTED], orgVO.a 
>> >> ddresses[0].company1, [get populated])
>> >> getAddrVOAL-->[]
>> >> <Feb 26, 2004 6:17:08 PM IST> <Error> <HTTP> <BEA-101017> 
>> >> <[ServletContext(id=1735147,name=gbs,conte
>> >> xt-path=/gbs)] Root cause of ServletException. 
>> >> java.lang.ArrayIndexOutOfBoundsException
>> >>         at java.lang.reflect.Array.get(Native Method)
>> >>         at 
>> >> org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(Propert
>> >> y
>> >> U
>> >> tils.
>> >> java:525)
>> >>         at
>> >> org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(Property 
>> >> U
>> >> tils.
>> >> java:428)
>> >>         at
>> >> org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyU 
>> >> t
>> >> ils.j
>> >> ava:770)
>> >>         at
>> >> org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.j 
>> >> a
>> >> va:80
>> >> 1)
>> >>         at
>> >> org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:881)
>> >>         at
>> >> org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
>> >>         at
>> >> org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252)
>> >>         at
>> >> org.apache.struts.action.RequestProcessor.processPopulate(RequestProce 
>> >> s
>> >> sor.j
>> >> ava:821)
>> >>         at
>> >> org.apache.struts.action.RequestProcessor.process(RequestProcessor.jav 
>> >> a
>> >> :254)
>> >>         at
>> >> com.puma.gbs.action.RequestProcessor.process(RequestProcessor.java: 
>> >> 133)
>> >>         at
>> >> org.apache.struts.action.ActionServlet.process(ActionServlet.java: 
>> >> 1482)
>> >>         at
>> >> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
>> >>         at  
>> >> javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
>> >>         at  
>> >> javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>> >>         at
>> >> weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run( 
>> >> S
>> >> ervle
>> >> tStubImpl.jav
>> >> a:1053)
>> >>         at
>> >> weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImp 
>> >> l
>> >> .java
>> >> :387)
>> >>         at
>> >> weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
>> >>         at
>> >> weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.jav 
>> >> a
>> >> :27)
>> >>         at
>> >> weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction 
>> >> .
>> >> run(W
>> >> ebAppServletC
>> >> ontext.java:6316)
>> >>         at
>> >> weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticated 
>> >> S
>> >> ubjec
>> >> t.java:317)
>> >>         at
>> >> weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
>> >> 118)
>> >>         at
>> >> weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSer 
>> >> v
>> >> letCo
>> >> ntext.java:36
>> >> 22)
>> >>         at
>> >> weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImp 
>> >> l
>> >> .java
>> >> :2569)
>> 
>=== message truncated ===
>
>
>__________________________________
>Do you Yahoo!?
>Get better spam protection with Yahoo! Mail.
>http://antispam.yahoo.com/tools
>
>---------------------------------------------------------------------
>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]

Reply via email to