• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to use logic:iterator tag inorder to iterate ArrayList consisting of HashMap

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

here i am facing the problem about how to use iterator tag i.e<logic:iterator/> in JSP's inorder to iterate Arraylist object containing HashMap elements!

i will provide part of my Action class code where i used arraylist and hashmap:

ArrayList arl=new ArrayList();
while(rs1.next()){
System.out.println("enter the loop");
HashMap map = new HashMap();
String name=rs1.getString("name");
String email=rs1.getString("email");
String phno=rs1.getString("phno");
map.put("NAME" , name);
map.put("EMAIL" , email);
map.put("PHNO", phno);
arl .add(map);
System.out.println(arl);
}
request.setAttribute("arll",arl);
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<logic:iterate id="person" name="arll">
<logic:iterate id="details" name="person" >
<bean:write name='details' property='key'/>  
<bean:write name='details' property="value" />
</logic:iterate>
</logic:iterate>

-HTH
 
sreelakshmi kolla
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ranjit,

Thank you very much!its works fine!

Once again Thank you!

Regards,
sree.
 
I've got no option but to sell you all for scientific experiments. Or a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic