Win a copy of Head First Android this week in the Android forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Hashtable and iterate

 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello
I have a class with method getRegion() which return Hashtable.

Is it possible to iterate this hashtable in jsp?
i tried like this:

this gives me only last record in hashtable as i can see.
Any suggestions?
Thx in advance.
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ilja,
It looked logical to me!! The only problem I can see is that the tag bean:write is not ended.
Your code says:

I think it needs to be:

I'm not sure though, if this will change the result :-(!
Cheers!
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I hope it will work because we used iterate for Hashmap so it will work you have to use following way.
<%
Map map = new HashMap();
map.put("seven", new Integer(7));
map.put("nine", new Integer(9));
map.put("thirteen", new Integer(13));
request.setAttribute("map",map);
%>
<logic:iterate id="it" name="map">
<bean:write name="it" property="key"/>=
<bean:write name="it" property="value"/>
</logic:iterate>
 
Ilja Smoli
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thx very much guyz.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic