yes I have a form bean with a List of school beans each of which has a list
of course beans

form bean methods:
getSchools
setSchools
getSchool(int)
setSchool(int, school)

school bean methods:
getCourses
setCourses
getCourse(int)
setCourse(int, course)

When I submit the form, only the schools are repopulated.  The courses
_can't_ be because the html renders the fields as such:

<input type="text" name="school[0].name" value="abc">
<input type="text" name="course[0].courseTitle" value="123">
<input type="text" name="course[1].courseTitle" value="456">
<input type="text" name="school[1].name" value="xyz">
<input type="text" name="course[0].courseTitle" value="123">
<input type="text" name="course[1].courseTitle" value="456">

and, of course, the form bean doesn't have accessors for courses, only for
schools.  There's a missing level of nesting...

> -----Original Message-----
> From: Mark Lowe [mailto:[EMAIL PROTECTED]
> Sent: Monday, March 29, 2004 11:26 AM
> To: Struts Users Mailing List
> Subject: Re: nesting c:forEach loops
> 
> 
> 
> The same way as you populated it in the first place.
> 
> Do you have something like this?
> 
> SchoolApplicationForm theForm = (SchoolApplicationForm);
> List schoolList = new ArrayList();
> SchoolForm school = new SchoolForm();
> school.setCourse(0,new CourseForm());
> schoolList.add(school);
> 
> theForm.setSchools(schoolList);
> 
> 
> You don't nested tag lib.. I never use it, as good as I think it is.
> 
> 
> On 29 Mar 2004, at 19:17, Jarnot Voytek Contr AU/SC wrote:
> 
> > I'm not using a dynaActionForm, my problem lies with the html that's
> > rendered...  Displaying the form works fine, but I don't see how 
> > struts will
> > repopulate my nested beans.
> >
> >> -----Original Message-----
> >> From: Mark Lowe [mailto:[EMAIL PROTECTED]
> >> Sent: Monday, March 29, 2004 11:14 AM
> >> To: Struts Users Mailing List
> >> Subject: Re: nesting c:forEach loops
> >>
> >>
> >> If you're using dynaActionForm you need to extract the map from the
> >> dynaForm.
> >>
> >> ${applicationForm.map.schools}
> >>
> >> other than that looks like it should work just fine as it is.
> >>
> >>
> >> On 29 Mar 2004, at 19:02, Jarnot Voytek Contr AU/SC wrote:
> >>
> >>> Is it possible to nest forEach loops and have the html:text input
> >>> fields
> >>> work correctly?
> >>>
> >>> My JSP code:
> >>> <c:forEach items="${applicationForm.schools}" var="school">
> >>>   <tr>
> >>>     <td>
> >>>       <html:text indexed="true" name="school" property="name"/>
> >>>     </td>
> >>>   </tr>
> >>>   <c:forEach items="${school.courses}" var="course">
> >>>     <tr>
> >>>       <td>
> >>>         <html:text indexed="true" name="course"
> >>> property="courseTitle"/>
> >>>       </td>
> >>>     </tr>
> >>>   </c:forEach>
> >>> </c:forEach>
> >>>
> >>> Within the second loop, input field names are rendered as
> >>> course[0].courseTitle rather than the required
> >>> school[0].course[0].courseTitle.  Any ideas on nesting
> >> these loops?
> >>> I'd
> >>> rather stick with JSTL and html-el rather than the nested taglib.
> >>>
> >>>
> >>> --
> >>> Voytek Jarnot
> >>> Quantum materiae materietur marmota monax si marmota 
> monax materiam
> >>> possit
> >>> materiari?
> >>>
> >>>
> >>>
> >> 
> ---------------------------------------------------------------------
> >>> 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]
> >>
> >
> > 
> ---------------------------------------------------------------------
> > 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]
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to