Do this:

<ww:iterator value="myHashMap">
 desc: <ww:property value="key"/>
 <p>
 <ol>
 <ww:iterator value="value">
   <li><ww:property value="."/>
 </w:iterator>
 </ol>
 <p>
</ww:iterator>

That works because iterating over a Map results in the inner object being a
Map.Entry object, which in turn has two methods: getKey() and getValue().

-Pat

----- Original Message -----
From: "Martin Samal" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, October 28, 2002 3:53 AM
Subject: [OS-webwork] iterating through a hashmap


> hi,
>
> I have a HashMap, containing (e.g.) the following values:
>
>   KEY: Description-Object,
>   VALUE: an ArrayList containing Option-Objects
>
> an Option-Object (simplified) has the following attributes:
>  int optionId;
>  String optionDesc;
>
> the description-object (simplified) has the following attributes:
>  int descId;
>  String desc;
>
> My question is, how can I iterate over the HashMap and achieve the
following
> output:
>
>  desc: Mercedes
>  1) optionDesc: 100 horsepower
>  2) optionDesc: ABS
>
>  desc: Opel
>  1) optionDesc: turbo-booster
>  2) optionDesc: five gears
>  3) optionDesc: three doors
>
> When I iterated over a collection, i (finally..) did not have any
problems -
> it worked very well!
> But with the HashMap - no success so far. I have a setter/getter-Method,
> which is invoked, but no output is created.
>
> I guess the problem is that I haven't figured out so far, how I can tell
> Webwork to access the values inside the HashMap with the <webwork:property
> value="..."/> - Tag. How can I tell Webwork what to take from the
key-object
> and what from the value-object?
>
> Thanks for any advice, also looked through the mailinglist for this
problem,
> but I could not find an answer.
>
> regards and thanks in advance,
>    Martin Samal
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Opensymphony-webwork mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to