posted 6 years ago
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
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
