Meaningless Drivel is fun!*
The moose likes JSP and the fly likes enabling  side menu based on user role in JSP? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "enabling  side menu based on user role in JSP?" Watch "enabling  side menu based on user role in JSP?" New topic
Author

enabling side menu based on user role in JSP?

mallikarjun dontamsetti
Ranch Hand

Joined: Mar 18, 2011
Posts: 244

I want to create a application that has two types of users say Admin,user based on their role i have to show the side menu items in the application. anyone give me some idea how it will be done..?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

Use the <c:if> and <c:choose>JSTL tags to make decisions.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
manni ma
Greenhorn

Joined: Oct 07, 2011
Posts: 2
One way is to have an XML file containing role information. Onload of a page you can write javascript function to parse an XML file and create menus at runtime.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

manni ma wrote:One way is to have an XML file containing role information. Onload of a page you can write javascript function to parse an XML file and create menus at runtime.

Umm, no. Bad idea. JavaScript can be disabled or spoofed easily. This is the sort of thing that needs to be done on the server.
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

As bear suggested, authorization should be done on server side.
mallikarjun dontamsetti
Ranch Hand

Joined: Mar 18, 2011
Posts: 244

Then i have to create two side menu's and if login member is admin display one thing and if he is user display another
like


is there any other solution....
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

What's wrong with that one?
mallikarjun dontamsetti
Ranch Hand

Joined: Mar 18, 2011
Posts: 244

I have to create two header pages and two side menu pages....so..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: enabling side menu based on user role in JSP?