You need UIViewRoot#findComponent() rather than UIViewRoot#getComponent().
And this should be done in the beforePhase of the render response.
Said that, I would rather just use the component's 'rendered' attribute to fulfill this requirement. Do you also know that you can just use EL in the styleClass attribute?
OK, here is my code in the phase listener. In the Before phase there is no children to the UIViewRoot. The children components are not available until the LifeCycleImpl, so I tried this in the AfterPhase. The components are found but nothing happens. It seems the components are already rendered, and the response is complete so I cannot change them. What am I missing. by the way I took this code from another post on this site.
public class LifeCycleListener implements PhaseListener { public void beforePhase(PhaseEvent event) {
The reason why I am trying this is for field level security. Based on the user and or group we will need to hide/show, disable/enable, for almost all the fields on the page. This was just one idea to stream line the process so we did not fill our backing beans with all this code. The idea was to loop thru the components on the page, call a database (would be cached for session) and set the appropriate attribute for all the necessary fields.
Just an idea and I saw that based on several web pages that this can be done, but apparently it cannot be.
Post by:autobot
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
a bit of art, as a gift, the permaculture playing cards