You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Evgeniy Strokin <ev...@yahoo.com> on 2004/12/15 16:03:52 UTC
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="homer@simpson.com">
<input type="text" name="email[1].emailAddress"
value="bart@simpson.com">
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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: indexed property is not updated after submit
Posted by Sebastián Gorgo <sg...@frro.utn.edu.ar>.
Evgeniy Strokin wrote:
> Thanks,
> but the server doesn't respond. Could you sent the pdf
> or copy and past the page from pdf.
> I'm really stack with this problem and appreciate any
> help.
>
> --- Sebastián Gorgo <sg...@frro.utn.edu.ar> wrote:
>
>
>>Evgeniy Strokin wrote:
>>
>>>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="homer@simpson.com">
>>><input type="text" name="email[1].emailAddress"
>>>value="bart@simpson.com">
>>>
>>>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:
>>
>>user-unsubscribe@struts.apache.org
>>
>>>For additional commands, e-mail:
>>
>>user-help@struts.apache.org
>>
>>>
>>>.
>>>
>>
>>
> http://stealthis.athensgroup.com/presentations/Model_Layer_Framework/Struts_Whitepaper.pdf
>
>>Page 10.
>>
>>
>
> ---------------------------------------------------------------------
>
>>To unsubscribe, e-mail:
>>user-unsubscribe@struts.apache.org
>>For additional commands, e-mail:
>>user-help@struts.apache.org
>>
>>
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
> .
>
It generates folowing HTML:
<input type="text" name="email[0].emailAddress"
value="homer@simpson.com">
<input type="text" name="email[1].emailAddress"
value="bart@simpson.com">
You must redefine the method getEmail(int index) and setEmail(int index,
Email email) in the form. Those methods must call
SecurityAdminModel.getEmail(int index) and
SecurityAdminModel.setEmail(int index, Email email) respectively.
When submit form, the application will execute form.setEmail(index,
email) and actualize your bean.
Excuse me. My english not is good.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: indexed property is not updated after submit
Posted by Evgeniy Strokin <ev...@yahoo.com>.
Thanks,
but the server doesn't respond. Could you sent the pdf
or copy and past the page from pdf.
I'm really stack with this problem and appreciate any
help.
--- Sebasti�n Gorgo <sg...@frro.utn.edu.ar> wrote:
> Evgeniy Strokin wrote:
> > 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="homer@simpson.com">
> > <input type="text" name="email[1].emailAddress"
> > value="bart@simpson.com">
> >
> > 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:
> user-unsubscribe@struts.apache.org
> > For additional commands, e-mail:
> user-help@struts.apache.org
> >
> >
> > .
> >
>
>
http://stealthis.athensgroup.com/presentations/Model_Layer_Framework/Struts_Whitepaper.pdf
>
> Page 10.
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
>
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: indexed property is not updated after submit
Posted by Sebastián Gorgo <sg...@frro.utn.edu.ar>.
Evgeniy Strokin wrote:
> 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="homer@simpson.com">
> <input type="text" name="email[1].emailAddress"
> value="bart@simpson.com">
>
> 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: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
> .
>
http://stealthis.athensgroup.com/presentations/Model_Layer_Framework/Struts_Whitepaper.pdf
Page 10.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org