<input type="text" name="days[10].workgroups[2].employeeAppointments[10].fullName" value="Foo">
Why is struts generating a days[10] when there are only 6 days in my collection? Better still, why is the days index tied to the employeeAppointments index? <%@ page language="java"%> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> <%@ taglib uri="/WEB-INF/struts-template.tld" prefix="template"%> <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> <%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested"%> <%@ taglib uri="/WEB-INF/cfa-logic.tld" prefix="clogic"%> <html:form action="saveUnitDayScheduleAction.do"> <logic:iterate id="days" indexId="dowId" name="unitDayScheduleForm" property="days" > <!-- process day <nested:write property="label" name="days"/> --> <h1><nested:write property="label" name="days" /></h1> <nested:hidden property="value" name="days" indexed="true" /> <nested:hidden property="date" name="days" indexed="true" /> <table> <tbody > <nested:iterate id="workgroups" name="days" property="workgroups"> <!-- process workgroup <nested:write property="name" /> --> <!-- work groups --> <tr class=""> <td class="clsRowGroupHeader" colspan="1" nowrap="nowrap"> <nested:write property="name"/> </td> </tr> <nested:iterate id="employeeAppointments" property="employeeAppointments"> <!-- process appointment <nested:write property="fullName" /> --> <tr> <td nowrap="nowrap"> <nested:text property="fullName" indexed="true"/> </td> </tr> </nested:iterate> </nested:iterate> </tbody> </table> </logic:iterate> </html:form> -----Original Message----- From: David McReynolds [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 17, 2004 4:46 PM To: [EMAIL PROTECTED] Subject: Indexed properties I am getting the nested beans out of my form ok but saving gives no joy. I am trying to use the "2.1 Hand Cranking lazy List in the ActionForm" from http://wiki.apache.org/struts/StrutsCatalogLazyList. However, I never see my log messages from the indexed getter methods for any of the nested beans. <nested:form action="saveUnitDayScheduleAction.do"> <nested:iterate id="days" property="days" > <nested:iterate id="workgroups" property="workgroups"> <nested:iterate id="employeeAppointments" property="employeeAppointments"> <nested:hidden property="statusCode" indexed="true" /> </nested:iterate> </nested:iterate> </nested:iterate> </nested:form> The form has a collection of DayOfWeekBeans called days. Each DOW bean has a collection of WorkgroupBeans called workgroups. Each WG bean has a collection of EmployeeAppointmentBeans called employeeAppointments. To that end the form and each of DOW and WG beans have the following general construct (in a garish form of C++ template syntax). public <BEAN_TYPE> get<LIST>(int index) { while (index >= <list>.size()) { <list>.add(new <BEAN_TYPE>()); } return (<BEAN_TYPE>)<list>.get(index); } And of course the appropriate public List get<LIST>(){ return <list>;} and Public void set<LIST>( List <list> ) { this.<list> = <list>;} The above JSP leads to this html fragment. <form name="unitDayScheduleForm" method="post" action="/labor/saveUnitDayScheduleAction.do"> <input type="hidden" name="unitDayScheduleForm[0].days[0].workgroups[0].employeeAppointments[ 0].statusCode" value="N"> <input type="hidden" name="unitDayScheduleForm[1].days[0].workgroups[0].employeeAppointments[ 1].statusCode" value="N"> <input type="hidden" name="unitDayScheduleForm[2].days[0].workgroups[0].employeeAppointments[ 2].statusCode" value="N"> <input type="hidden" name="unitDayScheduleForm[3].days[0].workgroups[0].employeeAppointments[ 3].statusCode" value="N"> <input type="hidden" name="unitDayScheduleForm[4].days[0].workgroups[0].employeeAppointments[ 4].statusCode" value="N"> <input type="hidden" name="unitDayScheduleForm[5].days[0].workgroups[0].employeeAppointments[ 5].statusCode" value="N"> <input type="hidden" name="unitDayScheduleForm[6].days[0].workgroups[0].employeeAppointments[ 6].statusCode" value="N"> <input type="hidden" name="unitDayScheduleForm[7].days[0].workgroups[0].employeeAppointments[ 7].statusCode" value="N"> . . . Blah blah blah --------------------------------------------------------------------- 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]