You get IllegalArgument exception if  any of the objects in the path
model.currentPerson.contactInfo.emails[0].emailAddress are not instantiated
and the stack trace also should able to give you which property is null. Its
thrown by BeanUtils when trying to set the property. 
The action that displays the JSP usually  instantiates
com.mycomp.SecurityAdminModel object  or retrieves from business or data
layer  to intialise the dynaform. The form bean needs to be session scope,
so that the objects currentPerson,contactInfo,emails[0] etc are not null
when  the form is submitted and no indexed setter and getter methods are
required. Your Collection  of emails should be a ordered collection like a
List.

-----Original Message-----
From: Evgeniy Strokin [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 15, 2004 3:38 PM
To: Struts Users Mailing List
Subject: RE: indexed property is not updated after submit


I'm wandering could this exception be because value of
emailAddress is null?

--- Evgeniy Strokin <[EMAIL PROTECTED]> wrote:

> This is exactly that I have. Also i asumed that I
> need
> in ContactInfo.class something like this:
> public Email getEmails(int index){
>  return emails.toArray()[index];
> }
> 
> For property:
>
model.currentPerson.contactInfo.emails[0].emailAddress
> 
> But I notised that Struts calls getEmails() for this
> property instead of getEmails(0).
> getEmails(0) never called actualy.
> 
> I don't know what to do)))
> 
> Thanks
> Eugene
> 
> 
> --- "Kandula, Sunita" <[EMAIL PROTECTED]> wrote:
> 
> > 
> > Can you give code details of ContactInfo and Email
> > classes . 
> > I am assuming you will have something like the
> > following, basically no
> > indexed methods are required.
> > ContactInfo.class
> >     /**
> >      * @return
> >      */
> > 
> >     private Collection emails;
> >     public Collection getEmails() {
> >         return emails;
> >     }
> > 
> >     /**
> >      * @param collection
> >      */
> >     public void setEmails(Collection collection) {
> >         emails = collection;
> >     }
> > 
> > 
> > and your Email class should have following
> methods.
> > public String getEmailAddress() {
> >     return emailAddress;
> > }
> > 
> > /**
> >  * @param string
> >  */
> > public void setEmailAddress(String string) {
> >    emailAddress = string;
> > }
> > 
> > 
> > 
> > -----Original Message-----
> > From: Evgeniy Strokin
> > [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, December 15, 2004 2:40 PM
> > To: Struts Users Mailing List
> > Subject: RE: indexed property is not updated after
> > submit
> > 
> > 
> > Thanks,
> > I think I'm getting close))
> > But your example gives me this exception:
> > ---------------------------
> > Invalid argument looking up property
> >
>
model.currentPerson.contactInfo.emails[0].emailAddress
> > of bean form
> > ---------------------------
> > Could you clue me in why is what?
> > 
> > Thanks,
> > Eugene
> > 
> > --- "Kandula, Sunita" <[EMAIL PROTECTED]> wrote:
> > 
> > > Could be done like this:
> > > <%@ taglib uri="/WEB-INF/struts-nested.tld"
> > > prefix="nested" %>
> > > <nested:iterate name="form"
> > >
> property="model.currentPerson.contactInfo.emails"
> > >
> > >   <nested:text property="emailAddress" />
> > > </nested:iterate>
> > > 
> > > 
> > > 
> > > -----Original Message-----
> > > From: Evgeniy Strokin
> > > [mailto:[EMAIL PROTECTED]
> > > Sent: Wednesday, December 15, 2004 10:04 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: indexed property is not updated after
> > > submit
> > > 
> > > 
> > > Hi,
> > > I have a problem:
> > > Struts config file has:
> > > <form-beans>
> > > <form-bean name="form"
> > > type="org.apache.struts.action.DynaActionForm">
> > > <form-property name="model"
> > > type="com.mycomp.SecurityAdminModel"/>
> > > </form-bean>
> > > </form-beans>
> > > 
> > > On JSP I have:
> > > <logic:iterate id="email"
> > >
> property="model.currentPerson.contactInfo.emails"
> > > name="form" >
> > >   <html:text property="emailAddress"
> name="email" 
> > > </logic:iterate>
> > > 
> > > It generates folowing HTML:
> > > <input type="text" name="email[0].emailAddress"
> > > value="[EMAIL PROTECTED]">
> > > <input type="text" name="email[1].emailAddress"
> > > value="[EMAIL PROTECTED]">
> > > 
> > > But when I submit the form actual values in a
> bean
> > > are
> > > not updated. They are still the same.
> > > 
> > > This is my Bean:
> > > package com.mycomp.securityadmin;
> > > public class SecurityAdminModel implements
> > > Serializable{
> > > 
> > > private Person currentPerson=null;
> > >     public Phone getPhone(int ind){
> > >         if(currentPerson!=null &&
> > >                
> > currentPerson.getContactInfo()!=null
> > > &&
> > > currentPerson.getContactInfo().getPhones()!=null
> > &&
> > >                 ind>=0 &&
> > >
> >
>
ind<currentPerson.getContactInfo().getPhones().size())
> > >             return
> > >
> >
>
(Phone)currentPerson.getContactInfo().getPhones().toArray()[ind];
> > >         else return null;
> > >     }
> > > 
> > >     public void setPhone(int ind, Phone phone){
> > >         if(currentPerson!=null &&
> > >                
> > currentPerson.getContactInfo()!=null
> > > &&
> > > currentPerson.getContactInfo().getPhones()!=null
> > &&
> > >                 ind>=0 &&
> > >
> >
>
ind<currentPerson.getContactInfo().getPhones().size())
> > >
> >
>
currentPerson.getContactInfo().getPhones().toArray()[ind]=phone;
> > >     }
> > > 
> > >     public Address getAddress(int ind){
> > >         if(currentPerson!=null &&
> > >                
> > currentPerson.getContactInfo()!=null
> > > &&
> > >
> >
> currentPerson.getContactInfo().getAddresses()!=null
> > > &&
> > >                 ind>=0 &&
> > >                 ind
> > >
> >
>
<currentPerson.getContactInfo().getAddresses().size())
> > >             return
> > >
> >
>
(Address)currentPerson.getContactInfo().getAddresses().toArray()[ind];
> > >         else return null;
> > >     }
> > > 
> > >     public void setAddress(int ind, Address
> adr){
> 
=== message truncated ===



                
__________________________________ 
Do you Yahoo!? 
Take Yahoo! Mail with you! Get it on your mobile phone. 
http://mobile.yahoo.com/maildemo 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



************************************************************************** 
This e-mail and any files transmitted with it may contain privileged or 
confidential information. It is solely for use by the individual for whom 
it is intended, even if addressed incorrectly. If you received this e-mail 
in error, please notify the sender; do not disclose, copy, distribute, or 
take any action in reliance on the contents of this information; and delete 
it from your system. Any other use of this e-mail is prohibited. Thank you 
for your compliance.




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to