0 Replies Latest reply on May 17, 2008 11:34 AM by kristjan273.kristjan.slomsek.gmail.com

    facesContext.getViewRoot().findComponent("test") returns null

    kristjan273.kristjan.slomsek.gmail.com

      I am trying to instantiate some custom components from backing bean at page load - for dynamic menu generation.



      I have a method to generate that menu and this method is called from pages.xml action execute.



      UIForm form1 = (UIForm)facesContext.getViewRoot().findComponent("selectMenu");
      form1.getChildren().add(cmdButton);



      And at that moment form1 is null. I figured out that this action execute is called just before rendering, so it is obvious that's null.


      Question is - where to put this method or if there is some other pattern for dynamic menu generation at page load?


      tnx in advance,


      K