Ahh thanks a bunch Nich ya that took care of the problem. Apparently the
ActionForms class doens't take well to having overloaded functions.. like I
had it setup for.
thanks a bunch!
----- Original Message -----
From: "Nicholas L Mohler" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Thursday, August 14, 2003 1:59 PM
Subject: Re: Form Populating Error, help!!
>
>
>
>
>
> Not sure why this works when the form is in the session, but I think I see
> why it doesn't work in the request...
>
> I am pretty sure this is a naming issue. I would suggest changing the
name
> of the singular "indexedBeans" to "indexedBean" in two places:
> 1) In your JSP, the id attribute in the iterate tag represents one item
in
> your collection. When the form is submitted, Struts will use this name to
> get an instance of the indexedBean for the index that is provided with the
> attribute from the form: for example, indexedBean[5].description would get
> the PermissionLine object for the index 5.
> 2) In your form, the indexed getter should match the singular name you
> choose: getIndexedBean(int index) for example.
>
> Hope this helps.
> Nick
>
>
>
>
> "David Erickson"
> <[EMAIL PROTECTED] To: "Struts Users
Mailing List" <[EMAIL PROTECTED]>
> x.com> cc:
> Subject: Re: Form
Populating Error, help!!
> 08/14/2003 03:13
> PM
> Please respond to
> "Struts Users
> Mailing List"
>
>
>
>
>
>
> I forgot to mention this code works with no problems when the scope of the
> form is in session... *boggles*
>
> ----- Original Message -----
> From: "David Erickson" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Thursday, August 14, 2003 12:37 PM
> Subject: Re: Form Populating Error, help!!
>
>
> > I was thinking it had something to do with this function:
> > public PermissionLine getIndexedBeans(int index) {
> >
> >
> > System.out.println("Index Requested: " + index + " Size of Array: " +
> > this.myBeans.size());
> >
> > while (index >= this.myBeans.size())
> >
> > this.myBeans.add(new PermissionLine());
> >
> > return (PermissionLine) this.myBeans.get(index);
> >
> > }
> >
> > But i through that debugging code in there and it never gets output at
> all..
> > so it must be something to do with the populate function on copying
> getters
> > and setters from the form to the bean, but its the exact same bean i
used
> to
> > populate it with, doesnt make any sense.. anyone got any ideas?
> >
> > ----- Original Message -----
> > From: "Alawadhi, Mona" <[EMAIL PROTECTED]>
> > To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
> > Sent: Thursday, August 14, 2003 12:04 PM
> > Subject: RE: Form Populating Error, help!!
> >
> >
> > > It looks like there is a method expecting a certain type of param, and
> > it's
> > > getting something other than expected.
> > >
> > > -----Original Message-----
> > > From: David Erickson [mailto:[EMAIL PROTECTED]
> > > Sent: Thursday, August 14, 2003 2:01 PM
> > > To: Struts Mailing List
> > > Subject: Form Populating Error, help!!
> > >
> > >
> > > Getting this error:
> > > exception
> > >
> > > javax.servlet.ServletException: BeanUtils.populate
> > > at
> > > org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1254)
> > > at
> > >
> >
>
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j
>
> > > ava:821)
> > > at
> > >
> >
>
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
>
> > > at
> > >
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
> > > at
> > > org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
> > > root cause java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
> > > at java.util.ArrayList.RangeCheck(ArrayList.java:508)
> > > at java.util.ArrayList.get(ArrayList.java:320)
> > > at
> > >
> >
>
org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtils.
>
> > > java:521)
> > > at
> > >
> >
>
org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtils.
>
> > > java:428)
> > > at
> > >
> >
>
org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUtils.j
>
> > > ava:770)
> > > at
> > >
> >
>
org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:80
>
> > > 1)
> > > at
> > > org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:881)
> > > at
> > > org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
> > > When trying to submit to my bean. Here is my html code:<table
> border="3"
> > > bordercolor="#3300CC"><html-el:form
> > action="/saveuser.do?user=${param.user}"
> > > type="salesweb.EditUserForm"> <logic:iterate name="edituserForm"
> > > property="indexedBeans" id="indexedBeans">
> <tr><td><html:checkbox
> > > name="indexedBeans" property="available" indexed="true"/></td>
> > > <td><html:textarea name="indexedBeans" property="id" indexed="true"
> > /></td>
> > > <td><html:textarea name="indexedBeans" property="description"
> > indexed="true"
> > > /></td></tr> </logic:iterate></table><html:submit value="Submit
> > Changes"
> > > styleClass="submitButton"/></html-el:form>And the relevant form
> > code:public
> > > class EditUserForm extends ActionForm { private ArrayList myBeans =
> new
> > > ArrayList(); public ArrayList getIndexedBeans() { return
> > > this.myBeans; } public void setIndexedBeans(ArrayList myBeans)
> > > { this.myBeans = myBeans; } // THIS METHOD IS REQUIRED
> IF
> > > YOUR FORM IS OF REQUEST SCOPE. public PermissionLine
> > getIndexedBeans(int
> > > index) { while (this.myBeans.size() + 1 < index)
> > > this.myBeans.add(new PermissionLine()); return (PermissionLine)
> > > this.myBeans.get(index); }}The beans are stored in request scope..
> any
> > > ideas?Thanks!
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> > >
> >
>
****************************************************************************
>
> > *
> > > The information in this email is confidential and may be legally
> > privileged.
> > > It is intended solely for the addressee. Access to this email by
anyone
> > else
> > > is unauthorized.
> > >
> > > If you are not the intended recipient, any disclosure, copying,
> > distribution
> > > or any action taken or omitted to be taken in reliance on it, is
> > prohibited
> > > and may be unlawful. When addressed to our clients any opinions or
> advice
> > > contained in this email are subject to the terms and conditions
> expressed
> > in
> > > the governing KPMG client engagement letter.
> > >
> >
>
****************************************************************************
>
> > *
> > >
> > >
> > > ---------------------------------------------------------------------
> > > 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]