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 Iterate HashMap in jsp - Struts2 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 "Iterate HashMap in jsp - Struts2" Watch "Iterate HashMap in jsp - Struts2" New topic
Author

Iterate HashMap in jsp - Struts2

Arun Christopher
Greenhorn

Joined: Nov 18, 2008
Posts: 19
In my application I have to display menu items from database

Each menu Item(MenuVO) will have a menu-id(menuId), parent-menu-id(parentMenuId), menu-order(menuOrder).

I have a hashmap which contains a menu item as the key and sub menus as ArrayList of menus.



But the submenu items can also be a parent for a list of sub-sub-menu items.

How can I iterate this recursive HashMap in JSP/java(I can create a custom tag).

The menu will be displayed as



I know the menu goes only 4 or 5 levels deep but I dont want to hardcode 4 or 5 nested iterators in jsp.

Included screenshots for better understanding

Hashmap


Need to be arranged in below fashion and iterated in jsp(struts2)


This is also a similar thread


Thanks,
Arun

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Iterate HashMap in jsp - Struts2