Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Struts and the fly likes Iterate Hashmap of object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Iterate Hashmap of object" Watch "Iterate Hashmap of object" New topic

Iterate Hashmap of object

pax smith
Ranch Hand

Joined: Dec 13, 2005
Posts: 45

I am getting the problem to iterate the hashmap of objects.Follwing code works good for a vector but has some problem for HashMap. I know this is becuase hashmap key,value pair. Can any one correct it.

<logic-l resent name="AddTemplateForm" property="hmitemProperties">
<bean:size id="size"name="AddTemplateForm" property="hmitemProperties"/>
<b>Total No. of Template - <%=size%></b>
<logic-l:greaterThan name="size" value="0">
<logic-l:iterate id="itempro" name="AddTemplateForm" property="hmitemProperties">
<bean:write name="itempro" property="propertyName"/>

</logic-l resent>
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
If the information you want is in the key part of the hashmap, change the bean:write property to propertyName.key. If it is the value part of the hashmap that you want, use propertyName.value.

Consultant, Sima Solutions
I agree. Here's the link:
subject: Iterate Hashmap of object
It's not a secret anymore!