0 Replies Latest reply on Jul 29, 2008 12:35 PM by Robert Gallas

    Altering property of component in ComponentTree

    Robert Gallas Newbie


      I'm facing situation when I need to alter property of component in ComponentTree. Basicly programatically disabling component. I do not want to use component binding in JSF tags.

      I have tried to use for the task PhaseListener, and also View Handler but without any success.

      Here is piece of dummy code.

      Idea is that for compnent with given ID disabled property will be set. Component is found sucessfully but with no effect on rendered UI.

      private void disableButton() {
       viewRoot = FacesContext.getCurrentInstance().getViewRoot();
       if (viewRoot != null)
       private void traverseAndPrintComponent(UIComponent component) {
       if (component.getChildCount() == 0) {
       } else {
       List<UIComponent> components = component.getChildren();
       for (UIComponent comp:components) {
       private void printComponent(UIComponent component) {
       println("Component.Id: " + component.getId());
       println("Component.Family: " + component.getFamily());
       println("Component.Class: " + component.getClass());
       println("Component.ChildCount: " + component.getChildCount());
       if (component.getId() != null && component.getId().equals("button")) {
       println("Button component found ... disabling ...");

      Any idea how implement functionality?

      Thanks a lot.