In our application we used the approach to create it flexible by storing the information in database, bascially it consists of 4 tables
User
UserToRole - Assigns roles to users
MenuItems
ItemToRole - Assigns roles to menuitems
MenuItems may link themselves to upper level items for creating the menu structure. It also contains the ordering of the items. If the menu is built top level items are displayed according to user roles. If the toplevel items have subelements the same check is done again. Each menuItem holds the corresponding links to the jsp pages.
We implemented a very simple, but flexible solution:
For each user role the configuration file has the following structure (only submenus having level 1 are considered)
For each top level menu item either
= "menuAction.jsp" if there are no submenu items
or
=
subMenuAction.jsp
.....
subMenuAction.jsp
By analyzing the lines of the file succesively we get the role specific menu structure.
We implemented just this text structure, but the configuration file in XML format would in fact offer a more generally applicable solution.