You don't need the import, or the scriptlet, or the 'type' attribute in the
<logic:iterate> tag, and you should be able to use the 'name' and 'property'
attributes instead of the 'collection' attribute with a scriptlet. That is,
given what you said about your 'floorplan' object, the following should be
all you need:
<logic:iterate name="floorplan" property="hotSpots" id="hotspot">
The top is <bean:write name="hotspot" property="top" />
The width is <bean:write name="hotspot" property="width" />
The height is <bean:write name="hotspot" property="height" />
The left is <bean:write name="hotspot" property="left" />
</logic:iterate>
Hope this helps.
--
Martin Cooper
----- Original Message -----
From: "Narasimhan, Shyamala" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 05, 2001 7:02 AM
Subject: Iterating through a hashtable of objects
>
> Hi
>
> I am trying to iterate through the values of a Hashtable hotspots... below
> is the code that i am using to do this. I have floorplan in session scope
> and floorplan.getHotSpots() returns the hot spots. I know that i need to
> have HotSpotInfo bean in page scope but i am not sure that i am doing it
> right. kindly tell me what my mistake is. thanks in advance
>
> <%@page import="com.data.HotSpotInfo" %>
> .....
>
>
> <%
> {
> /// this is just a place holder in order to set hotspot in page scope.
> this is not the actual value in iteration...i know that this is not the
> right way to do it.
> HotSpotInfo hotspot = new HotSpotInfo(2, 400, 400, 30, 70, "green","");
>
> pageContext.setAttribute("hotspot", hotspot, PageContext.PAGE_SCOPE);
> }
> %>
>
>
> .....
>
> <logic:iterate collection="<%= floorplan.getHotSpots() %>" id="hotspot"
> type="com.data.HotSpotInfo">
> The top is <bean:write name="hotspot" property="top" />
> The width is <bean:write name="hotspot" property="width" />
> The height is <bean:write name="hotspot" property="height" />
> The left is <bean:write name="hotspot" property="left" />
> </logic:iterate>
>
> i find that it doesnt iterate thro the collection and only prints the
single
> value i created earlier in the page.
>
>