aspose file tools
The moose likes JSF and the fly likes Parametrize JSF managedBeans method Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "Parametrize JSF managedBeans method" Watch "Parametrize JSF managedBeans method" New topic
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
    
    7

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.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Parametrize JSF managedBeans method
 
Similar Threads
Passing data between beans
Passing Params
Can�t set managed bean property�.
Accessing a managed bean from within another managed bean
Which Package to Import to Use FacesContext's getRequestMap()?