Wendy Smoak wrote the following on 7/12/2005 7:48 PM:
From: "Rick Reumann" <[EMAIL PROTECTED]>

Here's an example from a demo app that I keep meaning
to post to show how it can be done using either the nested or regular
JSTL tags...


Please do!  Showing side by side examples from
   Struts "classic",
   Struts-EL + JSTL 1.0, and
   Struts + JSP 2.0 + JSTL 1.1

Well I sort of did most the part that you'd be concerned with:) The rest of the demo deals with dealing with the Lists to not get indexOutOfBounds etc... problem is so many different ways to deal with it.

<%-- JSTL way --%>

<c:forEach items="${companyForm.divisions}" var="division" varStatus="divstatus"> Division: <html:text property="divisions[${divstatus.index}].name" value="${division.name}" /><br> <c:forEach items="${division.departments}" var="department" varStatus="depstatus"> --- Department: <html:text property="divisions[${divstatus.index}].departments[${depstatus.index}].name" value="${department.name}" /><br>
    </c:forEach>
</c:forEach>


<%-- Nested tag way --%>

<nested:root name="companyForm">
  <nested:iterate property="divisions">
    Division: <nested:text property="name" /><br>
        <nested:iterate property="departments">
        --- Department: <nested:text property="name" /><br>
        </nested:iterate>
  </nested:iterate>
</nested:root>


--
Rick

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

Reply via email to