• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
sreelakshmi kolla
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • 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);
 
Ranjit Gopinathan
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Hi Ranjit,

Thank you very much!its works fine!

Once again Thank you!

Regards,
sree.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic