Nathan Maves wrote:
I have a 2 layered nested bean.
ie
Bean1 has n number of associated Bean2 Bean2 has n number of associated Bean3
I want to have a form that has an Array of Bean3's
Probem is that while iterating though Bean2's the count for the indexed property gets reset. Any clever ideas to get around this.
I usually use the nested tag although JSTL works also but is a bit more verbose.
(could be some typos below .. this not tested)
Assume an ActionForm with a propety Collection or List called listOf_A_Beans
<%-- Nested tag way --%> <nested:iterate property="listOf_A_Beans"> <nested:text property="someProperty" /><br> <nested:iterate property="listOf_B_Beans"> <nested:text property="someProperty" /><br> </nested:iterate> </nested:iterate>
<c:forEach items="${yourForm.listOf_A_Beans}" var="beanA" varStatus="beanAlistStatus">
<html:text property="listOf_A_Beans[${beanAlistStatus.index}].name" value="${beanA.someProperty}" /><br>
<c:forEach items="${beanA.listOf_B_Beans}" var="beanB" varStatus="beanBlistStatus">
<html:text property="listOf_A_Beans[${beanAlistStatus.index}].listOf_B_Beans[${beanBlistStatus.index}].name" value="${beanB.someProperty}" /><br>
</c:forEach>
</c:forEach>
-- Rick
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]