Thanks mark , hubert and paul. i removed scope = request and it is working
fine now.

(Temporary fix :-)) i'll try to use lazy list once i finish off my work)


With Regards

Partha


-----Original Message-----
From: Mark Lowe [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 26, 2004 8:35 PM
To: Struts Users Mailing List
Subject: Re: Problem in nested tags- Very Urgent - Please Help


Nice one..

For some reason i thought the Factory would involve more than it does,  
so i shied away from it.

Cheers Mark

On 26 Feb 2004, at 15:57, Paul, R. Chip 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(Propert 
>>> y
>>> U
>>> tils.
>>> java:428)
>>>         at
>>> org.apache.commons.beanutils.PropertyUtils.getNestedProperty(Property 
>>> U
>>> 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(RequestProc 
>>> e
>>> s
>>> sor.j
>>> ava:821)
>>>         at
>>> org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja 
>>> v
>>> 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(ServletStubIm 
>>> p
>>> l
>>> .java
>>> :387)
>>>         at
>>> weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
>>>         at
>>> weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja 
>>> v
>>> a
>>> :27)
>>>         at
>>> weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio 
>>> n
>>> .
>>> run(W
>>> ebAppServletC
>>> ontext.java:6316)
>>>         at
>>> weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate 
>>> d
>>> S
>>> ubjec
>>> t.java:317)
>>>         at
>>> weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
>>> 118)
>>>         at
>>> weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe 
>>> r
>>> v
>>> letCo
>>> ntext.java:36
>>> 22)
>>>         at
>>> weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm 
>>> p
>>> l
>>> .java
>>> :2569)
>>>         at
>>> weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
>>>         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
>>>>
>>> 2004-02-26 18:18:40,616 [ExecuteThread: '12' for queue:
>>> 'weblogic.kernel.Default'] DEBUG org.apache. struts.util.RequestUtils
>>> - Get module name for path
>>> /uma/showOrgDetails.do
>>> 2004-02-26 18:18:40,616 [ExecuteThread: '12' for queue:
>>> 'weblogic.kernel.Default'] DEBUG org.apache. struts.util.RequestUtils
>>> - Module name found: /uma 2004-02-26 18:18:40,616 [ExecuteThread:
>>> '12' for queue: 'weblogic.kernel.Default'] DEBUG org.apache.
>>> struts.action.RequestProcessor - Processing a 'POST' for path
>>> '/showOrgDetails'
>>>
>>>
>>>
>>> My OrgVO is like this.
>>>
>>> public class OrgVO  {
>>>
>>>     private ArrayList addresses = new ArrayList();//collection of
>>> addressVOs
>>>
>>>     /**
>>>      * Gets ArrayList of AddressVOs
>>>      *
>>>      * @return addrVOAL ArrayList  a list  of Address VO
>>>      */
>>>     public Object[] getAddresses() {
>>>             
>>>                     System.out.println("getAddrVOAL-->" + addresses);
>>>                     if (addresses != null) {
>>>                             return addresses.toArray();
>>>                     } else {
>>>                             return null;
>>>                     }
>>>
>>>     }
>>>             
>>>
>>>     /**
>>>      * Sets the list of  address  Valu Object
>>>      *
>>>      * @param  addrList ArrayList  new value of addrVOAL
>>>      */
>>>     public void setAddresses(Object[] addrList) {
>>>                     addresses = new ArrayList();
>>>                     for (int i = 0;i < addrList.length; i++) {
>>>                             addresses.add(addrList[i]);
>>>                     }
>>>             }
>>>
>>> }
>>>
>>>
>>> Can anybody help...
>>>
>>> Thanks in advance.
>>>
>>>
>>>
>>> With Regards
>>>
>>> Partha
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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]
>


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