• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

JSTL foreach question (vector in a hashmap)

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all,
I am trying to get a nested vector out of a hashmap. The problem is that the JSTL line returns a object and not the vector I need. Is there a way to convert this?

Here is a code snippet:
<c:forEach var='hashitem' items='${queryFormBean.hash}'>
<c:set var="hashsubitem" value="${hashitem.key}"/>
<c:forEach var='vectval' items='${hashsubitem}'>
- <c ut value='${vectval}'/>, <c ut value='${hashitem.value}'/><BR>
</c:forEach>
</c:forEach>

Later,
Seamus
[ April 07, 2006: Message edited by: Seamus Loftus ]
 
Sheriff
Posts: 67756
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Seamus Loftus:
The problem is that the JSTL line returns a object and not the vector I need.



The EL is interpretive. It will "return" whatever the object really is.

Secondly, in the following lines;


<c:set var="hashsubitem" value="${hashitem.key}"/>
<c:forEach var='vectval' items='${hashsubitem}'>



you are setting hashsubitem from the key of the Map.Entry instance and then attempting to iterate over that. Is the vector really the key of your Map? Or did you mean to iterate over the value?

If so, the line should be:



Finally, when posting code, please be sure to check the 'disable smilies' checkbox so that your <c:out> tags look less surprised!
 
mooooooo ..... tiny ad ....
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic