You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by John Engilis <jo...@wblgx.com> on 2003/06/18 19:56:40 UTC
Calling values by their key in a vector of hashtables...
I would like to iterate over a vector of hash tables and then pull the
values from the hashtable by the key... Will JSTL allow me to do this??
I've read through some JSTL books and I can see that one is able to iterate
over a vector with a forEach and then over a hashtable in the same fashion
displaying the keys and their associated value (in no specific order that
they were entered), but I'd like to be able to call a value by the key at
that point... Is that possible??
John Engilis
---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
Re: Calling values by their key in a vector of hashtables...
Posted by Hans Bergsten <ha...@gefionsoftware.com>.
John Engilis wrote:
> I would like to iterate over a vector of hash tables and then pull the
> values from the hashtable by the key... Will JSTL allow me to do this??
>
> I've read through some JSTL books and I can see that one is able to iterate
> over a vector with a forEach and then over a hashtable in the same fashion
> displaying the keys and their associated value (in no specific order that
> they were entered), but I'd like to be able to call a value by the key at
> that point... Is that possible??
Sure:
<c:forEach items="${myVector}" var="aMap">
<c:out value="${aMap.aKey}" />
</c:forEach>
Since you already know the key names, just use them; no need to loop
over them.
Hans
--
Hans Bergsten <ha...@gefionsoftware.com>
Gefion Software <http://www.gefionsoftware.com/>
Author of O'Reilly's "JavaServer Pages", covering JSP 1.2 and JSTL 1.0
Details at <http://TheJSPBook.com/>
---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org