I don't know how to do it with EL, but if you use scriptlets, something like
this *might* work:
<display:table id="tab" name="${fileStructure}">
<display:column title="FileName"sortable="true"><%= ((Map.Entry)
tab).key()</display:column>/>
<display:column title="Title"sortable="true"><%= ((Map.Entry)
tab).value()</display:column>/>
</display:table>
The only question is whether displaytag will successfully iterate the
hashmap, in which case no amount of attempting to interpret each returned
result will work. The problem is that displaytag works with lists of
objects. A HashMap is NOT a list (it implements AbstractMap, which is just
an object). You may need to convert the HashMap to a list of objects by
calling the entrySet() method. Since Set is a Collection and List is a
Collection, you can just create an ArrayList with the ArrayList(Collection
c) constructor from the results of the entrySet() method. Each entry in the
resulting list would be accessible through the Map.Entry.key() and
Map.Entry.value() calls.
Does that make sense?
Rick Herrick
[EMAIL PROTECTED]
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:displaytag-user-
> [EMAIL PROTECTED] On Behalf Of Nic Werner
> Sent: Monday, February 21, 2005 4:53 PM
> To: [email protected]
> Subject: [displaytag-user] Easy question with HashMaps
>
> Can someone please tell me how to pass a HashMap to DisplayTag and have
> the key and the value be accessed? I'd like the key in one column, and
> the value in another, is there a way to access these?
>
> Below does NOT work:
>
> <display:table id="tab" name="${fileStructure}">
> <display:column
> title="FileName"sortable="true">${tab.key}</display:column>/>
> <display:column
title="Title"sortable="true">${tab.value}</display:column>/>
> </display:table>
>
> Thanks,
>
> - Nic
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> displaytag-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/displaytag-user
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
displaytag-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/displaytag-user