Iterating Vector of Hashtables using c:forEach
I have Vector of Hashtables and each hash table has two elements with keys 'key1' an开发者_JS百科d 'key2'.
Now in the jsp page i have to iterate those vector and print those values in the hash table using jstl tag c:forEach
Could anybody helps how to do that using c:forEach
<c:forEach items="${yourVector}" var="ht">
<c:forEach items="${ht}" var="entry">
<c:out value="${entry.key}" />
</c:forEach>
</c:forEach>
Btw, use HashMap
instead of Hashtable
(and ArrayList
instead of Vector
)
<c:forEach items="${myVector}" var="ht">
<c:out value="${ht.key1}" />
<c:out value="${ht.key2}" />
</c:forEach>
Try this way, here you should know the key names.
精彩评论