This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Struts and the fly likes Problem in Iterating HashMap using logic:iterate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem in Iterating HashMap using logic:iterate" Watch "Problem in Iterating HashMap using logic:iterate" New topic
Author

Problem in Iterating HashMap using logic:iterate

Micheal John
Ranch Hand

Joined: Nov 01, 2006
Posts: 344
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?


Micheal John
SCJP 1.4 (86%), SCWCD 1.4 (86%), SCBCD 1.3 (85%), SCDJWS (Just Started...) - Satisfaction Lies in Our EFFORT, Not in the ATTAINMENT
R Laksh
Greenhorn

Joined: Aug 27, 2003
Posts: 25
It may be useful..

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


Thanks
R Laksh
Greenhorn

Joined: Aug 27, 2003
Posts: 25
It may be useful..

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


Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem in Iterating HashMap using logic:iterate