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){
        if(currentPerson!=null &&
                currentPerson.getContactInfo()!=null
&&
currentPerson.getContactInfo().getAddresses()!=null &&
                ind>=0 &&
ind<currentPerson.getContactInfo().getAddresses().size())
currentPerson.getContactInfo().getAddresses().toArray()[ind]=adr;
    }

    public Email getEmail(int ind){
        if(currentPerson!=null &&
                currentPerson.getContactInfo()!=null
&&
currentPerson.getContactInfo().getEmails()!=null &&
                ind>=0 &&
ind<currentPerson.getContactInfo().getEmails().size())
            return
(Email)currentPerson.getContactInfo().getEmails().toArray()[ind];
        else return null;
    }

    public void setEmail(int ind, Email email){
        if(currentPerson!=null &&
                currentPerson.getContactInfo()!=null
&&
currentPerson.getContactInfo().getEmails()!=null &&
                ind>=0 &&
ind<currentPerson.getContactInfo().getEmails().size())
currentPerson.getContactInfo().getEmails().toArray()[ind]=email;
    }
}

What do I do wrong?

Thanks,
Eugene 



                
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Find what you need with new enhanced search.
http://info.mail.yahoo.com/mail_250

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