Assuming you have a scoped Collection named "pageRecords":
Struts tags:
<logic:iterate id="myID" name="pageRecords">
<td> <bean:write name="myID" property="id" /> </td>
</logic:iterate>
JSTL:
<c:forEach var="user" items="${pageRecords}">
<c:out value="${user.id}"/>
</c:forEach>
robert
> -----Original Message-----
> From: Eddie Yan [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, June 23, 2004 12:06 PM
> To: [EMAIL PROTECTED]
> Subject: Logic:Iterate Problem
>
>
> Hi guys,
>
> Say I have a JSP as follows:
>
> <table>
> <tr>
> <%
> Iterator iter = pageRecords.iterator();
> while(iter.hasNext())
> {
> UserDetail detail = (UserDetail)iter.next();
> %>
> <td> <%= detail.getId() %> </td>
> <%
> }
> %>
> </tr>
> </table>
>
> pageRecords is a Collection of UserDetail object.
> UserDetail is my data transfer object.
> I can manage to get the expected result of detail.getId()
>
> How can I represent the above code in <logic:iterate> tags ?
> The following code doesn't work.
>
> <table>
> <tr>
> <logic:iterate id="myID" collection="pageRecords" property="UserDetail">
> <td> <bean:write name="myID" property="id" /> </td>
> </logic:iterate>
> </tr>
> </table>
>
> I got JSP Exception: Cannot create iterator for this collection
>
>
>
>
>
> ---------------------------------------------------------------------
> 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]