• Post Reply Bookmark Topic Watch Topic
  • New Topic

Parametrize JSF managedBeans method  RSS feed

 
Lukas Hnatuk
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I was wondered, if there is some way to do method in my Managed Bean iwth parameter. My problem is, that i am trying to do one menu based on roles of user and I need to do component, which would be able to do it.
Eg.


and in managed bean, i would like to have method like this


Is there some way to do this?
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't add arbitrary attributes to JSF tags. So in order to make a tag role-sensitive in the way you've illustrated, you'd have to modify or subclass the tag to include the "role" attribute.

If you're using an off-the-shelf menu tagset, however, the more common way to handle that is to either dynamically modify the bindings to the menu tag or alternatively to use "rendered=" attributes to reference boolean properties in a backing bean.

Sometimes I maintain a "securityContext" JSF bean that can be interrogated when I need fine-grained security. So I'd do something like this:

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!