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
posted Aug 13, 2007 09:34:00
0
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
posted Aug 13, 2007 09:34:00
0
It may be useful.. http://struts.apache.org/1.x/struts-taglib/tlddoc/logic/iterate.html Thanks
subject: Problem in Iterating HashMap using logic:iterate