1 Reply Latest reply on Mar 15, 2010 6:13 PM by nbelaevski

    How to get FaceletFactory  instance

    sandeepgowda

      hi,

      Can you help me in getting the FaceletFactory instance in Richfaces for present FacesContext.

       

      i have attached the code as below.

       

      FacesContext facesContext = FacesContext.getCurrentInstance();
                 
                  Application application = facesContext.getApplication();

       

                  UIViewRoot viewRoot = facesContext.getViewRoot();

       

                  // if (viewRoot instanceof PartialViewRoot) {
                  // viewRoot = ((PartialViewRoot) viewRoot).getBase();
                  // /*restorePartialView(facesContext, (PartialViewRoot) viewRoot);*/
                  // }

       

                  String id = "form" + UINamingContainer.SEPARATOR_CHAR
                          + "selectedPanel";
                  UIPanel includeSection = (UIPanel) viewRoot.findComponent(id);

       

                  if (includeSection == null) {
                      // LOG.error("Component with Id '" + id + "' was not found");

       

                      return;
                  }
                          
             
                 FaceletFactory ff =???????????????????
                  

      below is applicable only in Myfaces.

      ///(FaceletFactory) RequestStateManager.get(facesContext, //RequestStateManager.FACELET_FACTORY);

       


               Facelet ft = ff.getFacelet(getCurrentSectionPath());

                  // construct component sub-tree with given parent
                  ft.apply(facesContext, includeSection);

       

                  // some required magic ...
                  includeSection.getAttributes().remove("com.sun.facelets.MARK_ID");

       

       

      best regards

      Sandeep