File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes how to use logic:iterator tag inorder to iterate ArrayList consisting of HashMap Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to use logic:iterator tag inorder to iterate ArrayList consisting of HashMap " Watch "how to use logic:iterator tag inorder to iterate ArrayList consisting of HashMap " New topic
Author

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

sreelakshmi kolla
Ranch Hand

Joined: Aug 23, 2007
Posts: 35
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

Joined: Jul 03, 2007
Posts: 46
<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

Joined: Aug 23, 2007
Posts: 35
Hi Ranjit,

Thank you very much!its works fine!

Once again Thank you!

Regards,
sree.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to use logic:iterator tag inorder to iterate ArrayList consisting of HashMap