| Author |
Parametrize JSF managedBeans method
|
Lukas Hnatuk
Greenhorn
Joined: May 31, 2010
Posts: 10
|
|
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?
|
Sever: GlassFish v3
JSF 2.1
Mostly using NetBeans
|
 |
Tim Holloway
Saloon Keeper
Joined: Jun 25, 2001
Posts: 14491
|
|
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:
|
Customer surveys are for companies who didn't pay proper attention to begin with.
|
 |
 |
|
|
subject: Parametrize JSF managedBeans method
|
|
|