3 Replies Latest reply on Mar 15, 2010 6:18 PM by Nick Belaevski

    <ui:include src Dynamically load file issue

    Sandeep Gowda Newbie


      I am attached the code below, the component <ui:include, where SRC value change dynamically, but the browser is not getting reflected.


      only on browse Refresh(press of F5),its working, please help me in fix.



      <html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:f="http://java.sun.com/jsf/core" xml:lang="en" lang="en"
              <title>Customer Details</title>
              <meta http-equiv="keywords" content="enter,your,keywords,here" />
              <meta http-equiv="description"
                  content="A short description of this page." />
              <meta http-equiv="content-type" content="text/html; charset=UTF-8" />


      .cols {
          vertical-align: top;
          width: 50%;


              <h:form id="form">
                  <h:panelGrid columns="2" columnClasses="cols" width="100%">
                      <rich:panelMenu style="width:200px" mode="ajax"
                          iconExpandedGroup="disc" iconCollapsedGroup="disc"
                          iconExpandedTopGroup="chevronUp" iconGroupTopPosition="right"
                          <rich:panelMenuGroup label="Asset and Liability ">
                              <rich:panelMenuItem label="Asset"
                                  action="#{MainPanel.onAssetSelection}" reRender="selectedPanel">
                                  <a4j:support event="oncomplete" reRender="selectedPanel" ></a4j:support>
                              <rich:panelMenuItem label="Liability"
                                  <f:param name="strCurrent" value="/Jsf/SearchCustomer.xhtml" />
                          <rich:panelMenuGroup label="Group 2">
                              <rich:panelMenuItem label="Item 2.1">
                                  <f:param name="strCurrent" value="Item 2.1" />
                              <rich:panelMenuItem label="Item 2.2">
                                  <f:param name="strCurrent" value="Item 2.2" />
                              <rich:panelMenuItem label="Item 2.3">
                                  <f:param name="strCurrent" value="Item 2.3" />
                              <rich:panelMenuGroup label="Group 2.4">
                                  <rich:panelMenuItem label="Item 2.4.1">
                                      <f:param name="strCurrent" value="Item 2.4.1" />
                                  <rich:panelMenuItem label="Item 2.4.2">
                                      <f:param name="strCurrent" value="Item 2.4.2" />
                                  <rich:panelMenuItem label="Item 2.4.3">
                                      <f:param name="strCurrent" value="Item 2.4.3" />
                              <rich:panelMenuItem label="Item 2.5">
                                  <f:param name="strCurrent" value="Item 2.5" />
                          <rich:panelMenuGroup label="Group 3">
                              <rich:panelMenuItem label="Item 3.1">
                                  <f:param name="strCurrent" value="Item 3.1" />
                              <rich:panelMenuItem label="Item 3.2">
                                  <f:param name="strCurrent" value="Item 3.2" />
                              <rich:panelMenuItem label="Item 3.3">
                                  <f:param name="strCurrent" value="Item 3.3" />
                      <h:panelGroup id="selectedPanel" rendered="true">
                          <rich:panel bodyClass="rich-laguna-panel-no-header">
                              <a4j:outputPanel ajaxRendered="true">
                                  <ui:include src="#{MainPanel.strSelectedPath}"></ui:include>
                                  <h:outputText value="#{MainPanel.strSelectedPath}" id="Current" />




        • 1. Re: <ui:include src Dynamically load file issue
          Nick Belaevski Master

          Hi Sandeep,


          Try adding a4j:log to the page and check if there are any errors/warnings.

          • 2. Re: <ui:include src Dynamically load file issue
            Sandeep Gowda Newbie

            Thanks for the replay, but i tried log, no errors....


            But i understood that UI:Include is static loader, so we need the explicitly Load the component,


            But i am stuck while getting FaceletFactory instance. Canyou please help me. Below method will be called on click of menu.


            FacesContext facesContext = FacesContext.getCurrentInstance();


            Application application = facesContext.getApplication();
                         UIViewRoot viewRoot = facesContext.getViewRoot();
                         // if (viewRoot instanceof PartialViewRoot) {
                         // viewRoot = ((PartialViewRoot) viewRoot).getBase();
                         // /*restorePartialView(facesContext, (PartialViewRoot)
                         // }
                         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");
                         FaceletFactory factory = ?????HOW to Get Instance in Richfaces.
                         Facelet ft = factory.getFacelet(.strSelectedPath);
                         // construct component sub-tree with given parent
                         ft.apply(facesContext, includeSection);
                         // some required magic ...