dynamically loading webpage menu

Discussions

EJB programming & troubleshooting: dynamically loading webpage menu

  1. dynamically loading webpage menu (2 messages)

    There is only one menu for all.but the menu contents must display dynamically.for example in the menu i have news,blogs,discussions etc if user1 is entered then (discussions) will not be there if user2 (blogs) will not be there.admin have privilages of changing the menu contents for the user if the admin change the previlage for one user then there is a table in database that stores the previlages for the users depends on the database contents the menu shold display for every user i am not getting how to prceed in jsp and javascript
  2. I asume you have a table with user privileges, then other with all the menu options and finally other with privilege-menu_option. In your servlet, or action in struts or the equivalent, you have to acces the table privilege-menu_option with the current user logged data. Set in Session the menu options for which the user have privileges and in your Jsp read the Session atribute to form the menu. For example: A Vector with the title to display and the link for the option. In your javascript you have to read the vector formatting your menu accordingly.
  3. Generally user permissions are maintained by using Roles. - Permissions are attached to Roles. - Roles are attached to Users. But from what I understood from ur problem, you do not have roles and Admin assigns permissions directly to Users. So may be now you have 3 tables: Users, Permissions, User_Permissions Lets assume the following datastructures for ur Tables Users { UserID, UserName } Permissions { PermissionID, PermissionDesc } User_Permissions { UserID, PermissionID } Create 2 more tables: Menu{ MenuID, Name, URL } Permissions_Menu{ PermissionID MenuID } Now its easy... After a user logs-in... Get user permissions from User_Permissions table. And then for all the permissionId's user has... fetch the Menu Items from Permissions_Menu and build the menu. Krishna