Hi,

we looked in the Struts source code a second time. Line 283 and 284 says:

 else if (collection instanceof Map)
     iterator = ((Map) collection).entrySet().iterator();

This gets you an iterator of the *mappings* in the Map. So each element is a
java.util.Map.Entry - right ?
The doAfterBody method just put a Map.Entry in the pageContext for each
mapping in the HashMap.
So you would acutally have to do two <struts:getProperty> to get to the
value of each mapping in the entry set - one to retrieve the Map.Entry and
one to retrieve the value of the entry.

Is this the right way to do this ?

Regards,
Jannik

----- Original Message -----
From: "Jannik Nørgaard Steen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, November 24, 2000 12:21 PM
Subject: logic:iterate does not work with HashMap


> Hi,
>
> we're developing a web-app currently using Struts 0.5 milestone release.
> In this application we store a object in the session context that contains
a
> HashMap which we try to access
> from a JSP. This works fine.
> However when we try to iterate through the HashMap like this (contents
> property contains the HashMap):
>
> <logic:iterate id="materialItem"
> name="com.smartmediatech.internet.beans.MaterialResult"
property="contents">
> ..
> ..
> </logic:iterate>
>
> no materialItem bean is placed in the pageContext. This is odd because if
we
> use a ArrayList instead of a HashMap it works... but we need to use a
> HashMap for other reasons.
>
> We've looked in the iterate tag handler source code an cannot see why it
> does not work.
> Have we missed something or is this a bug ?
>
> Med venlig hilsen/Best Regards
>
> Jannik Nørgaard Steen
>
>
>

Reply via email to