wood burning stoves 2.0*
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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Iterate Hashmap of object" Watch "Iterate Hashmap of object" New topic
Author

Iterate Hashmap of object

pax smith
Ranch Hand

Joined: Dec 13, 2005
Posts: 45
Hi

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:iterate>
</logic-l:greaterThan>
</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.


Merrill
Consultant, Sima Solutions
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Iterate Hashmap of object