class MyForm{
public BankInfoStringBean getBankInfoBean(int index){
//lazy initialization
while(index >= this.getBankList().size() ){
this.getBankList().add(new BankInfoStringBean());
}
return (BankInfoStringBean)this.getBankList().getObject(index);
}
public void setBankInfoBean(int index,BankInfoStringBean bean){
this.getBankList().add(index,bean);
}
}//class myForm
<logic:iterate id="beanName" name="myFormName"
property="participantAllocationDetailSBList" indexId="i">
<tr>
<td>
<html:hidden name="myFormName"
property="<%=\"bankInfoBean[\"+i+\"].name\"%>"/>
</td>
</tr>
</logic:iterate>
Here myFormName is the name from ActionMapping.
HTH.
Regards,
Shirish
-----Original Message-----
From: Frederic Dernbach [mailto:[EMAIL PROTECTED]
Sent: Friday, October 03, 2003 9:59 AM
To: struts-layout; struts-user
Subject: Need for a sample with indexed properties
Following up on a previous post, I currently experience big difficulties
managing indexed properties in a Struts form.
Can somebody send me a complete sample with :
- a form with an indexed properties (I need to see the setter and getter
methods). The O'Reilly "Programming Jakarta Book" says that, when a
property like <PrpertyElement>[] is defined, the following methods
should be present : get<PropertyName>(int a) and set<PropertyName>(int
a, ProperyElement b>
- the JSP reading this indexed property
- an action populating the indexed property before forwarding to the
JSP.
Thanks in advance.
---------------------------------------------------------------------
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]