Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in Iterating HashMap using logic:iterate

 
Micheal John
Ranch Hand
Posts: 344
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to iterate the hashmap using logic:iterate. How to do this?

For example:
In my action class:

HashMap h = new HashMap();
h.put("1","red1");
h.put("2","red2");
h.put("3","red3");
myForm form = myForm actionForm;
form.setH1(h);

In My jSP page, how to iterate it:
I have tried the following things:

<logic:iterate id="mapOutput" name="docListForm" property="h1">
TEST
</logic:iterate>

"TEST" Printed three time, so map is iterating

<logic:iterate id="mapOutput" name="docListForm" property="h1(1)">

</logic:iterate>

The above onbe returne "red1".

But how to iterate the map and I want to display only "red1", red2" and "red3".

Any suggestions/idea on how to achive it?
 
R Laksh
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It may be useful..

http://struts.apache.org/1.x/struts-taglib/tlddoc/logic/iterate.html


Thanks
 
R Laksh
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It may be useful..

http://struts.apache.org/1.x/struts-taglib/tlddoc/logic/iterate.html


Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic