This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

displaying different menu according to specific user on same page  RSS feed

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

i am beginner in java and i am making an application in which i want to display menu for 3 different types of users. like when we login i want to check which type of user is this and which menu to show them. for ex. if there is a employee the menu bar has a dropdown which shows activities like fill nomination, see details etc. if it privileged user he is shown a diff menu and if its the admin the dropdown shows some different activities. i want to make it through simple jsp and servlet. i have a table in data base which has types of user predefined with an id how to display that menu according to a specific user is my query please help me anyone who has any sample code for this or any suggestion. thank you in advance.
please please reply asap.
 
Ranch Hand
Posts: 33
Google Web Toolkit Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi,

1. Create a one user table

This table is User master


2. Create one Role table

This is Role master


3. create one mapping table user and role.

This is User and role mapping


4. Create one RoleAccess Table

This table contains the details of menu option as per role.



Thanks,
Ganesh Shirsat
 
niharika thakur
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Mr. Girish

why to use 2 tables i.e user master and role as both of them showing the same thing......... i have 3 users employee, privileged & admin
can you please suggest the coding idea using jsp and servlet.
like how to use this tables in actual coding..
thanks in advance & thanks for replying as well.
 
Author and ninkuma
Marshal
Posts: 66797
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Before even thinking about the JSP to create the HTML you need to design the HTML that will accomplish what you want. Have you done that?
 
niharika thakur
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ya i have done that.... but i am just confused in this thing. The template is ready
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66797
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wel then, it sounds as if it is now a simple matter of using the condition JSTL tags to decide what gets shown or not using the role of the user.
 
niharika thakur
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
actually i have never used JSTL tags.. so i have no idea about it... i'm stuck in between and its getting very confusing now...... any sample code or something related to this topic would b a great help...
thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66797
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Before proceeding you need to understand basic JSP with the JSTL and EL. Otherwise, you'll just be flying in the dark.

I'd suggest finding a good book on the subject. See the Bunkhouse for suggestions.
 
Master Rancher
Posts: 3625
39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

niharika thakur wrote:Hello,

Mr. Girish

why to use 2 tables i.e user master and role as both of them showing the same thing......... i have 3 users employee, privileged & admin
can you please suggest the coding idea using jsp and servlet.
like how to use this tables in actual coding..
thanks in advance & thanks for replying as well.



Those are roles.
Presumably you would have multiple users that would have the 'employee' role.
You don't want to go through the hassle of assigning each of those users the same set of privileges, which is why the roles exist. You can then just assign the 'employee' role to them, which defines those privileges.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!