File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Customizing Menu Bar base on Security Role Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Customizing Menu Bar base on Security Role" Watch "Customizing Menu Bar base on Security Role" New topic

Customizing Menu Bar base on Security Role

Alec Lee
Ranch Hand

Joined: Jan 28, 2004
Posts: 569
In tiles taglib, I can see the role= attribute for customizing view base on user's role. I am wondering if this attribute is also available in other struts taglib like <html:link>. I want to have a list of links to be optionally displayed only when the user is logged in as certain role.

What else could I use to achieve this result. Would there be any ready made taglib supporting this?
Ergin Er
Ranch Hand

Joined: Sep 06, 2005
Posts: 60
I don't know if you can use the roles in the tags. That would be very nice if it could.

But other way to achieve what you want is using some flag attributes in the code (if a certain user logs on set this flag to a value and compare in your view on that flag), or using <logic:equals> on the current user attribute that contains users role (if the user is put in the session).
Marc Peabody
pie sneak

Joined: Feb 05, 2003
Posts: 4727

It wouldn't be very difficult to implement this by creating your own taglib or extending Struts tags. It may seem intimidating now but once you get started you'll be fine.

A good workman is known by his tools.
I agree. Here's the link:
subject: Customizing Menu Bar base on Security Role
It's not a secret anymore!