You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mark Lowe <ma...@talk21.com> on 2004/01/12 13:39:46 UTC

[ot] someMap.keySet() JSTL?

anyone know a way of getting the set of keys from a hashmap in jstl?

in java

Set keys = someMap.keySet();

i've tried

<c:forEach var="keys" items="${someForm.items.keySet}">

to no avail ..


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: [ot] someMap.keySet() JSTL?

Posted by Kris Schneider <kr...@dotech.com>.
Can't do it directly with JSTL 1.0. If you just iterate over the map, you'll get
instances of Map.Entry, which will expose "key" and "value" properties.

With JSP 2.0, I suppose you could define a custom EL function that would let you
do something like:

<c:forEach var="keys" items="${maps:keySet(someForm.items)}">
...

Quoting Mark Lowe <ma...@talk21.com>:

> anyone know a way of getting the set of keys from a hashmap in jstl?
> 
> in java
> 
> Set keys = someMap.keySet();
> 
> i've tried
> 
> <c:forEach var="keys" items="${someForm.items.keySet}">
> 
> to no avail ..

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org