2 Replies Latest reply on Apr 14, 2014 10:55 AM by timpii

    rich:editor and rich:fileUpload after dynamic ui:include display problem

    timpii

      I am having the following issue with both the rich:editor and the rich:fileUpload after a dynamic ui:insert as follows:

       

      <rich:tab >

        <ui:include src="#{mbrAction.mbrCommunityAction.registrationTab}"/> // This is where the problem is

      // <rich:fileUpload />  // Works fine here

      //<ui:include src="/communities/contributor/compositions/contributorRegistration.xhtml" /> // works fine if page hard coded

      </rich:tab

       

      I have upgraded to richfaces 4.3.6, jsf 2.1.19, jboss as 7.1.1 and still have the problem. I have tried different versions of each with no luck.

       

      The issue is that the first time I go through the include the rich:editor and the rich:fileUpload components incorrectly - see the attached files for both good and bad screen shots of each. I have looked at the responses coming back and can find no difference - again see the attachments for the responses as obtained via firebug. In my template I have the following to help the rich:editor:

      <script>

        window.CKEDITOR_BASEPATH = '#{request.contextPath}/org.richfaces.resources/javax.faces.resource/org.richfaces.ckeditor/';

      </script>

       

      So I can get the components to display properly if I first enter the page, get the bad display and then go back to the home page and navigate the selections back to the page. The second time through they display properly.  I am assuming that somehow the first time through sets some css or javascript that the dynamic ui:include is stripping but honestly I can not figure out what is going on. Again if I hard code the include as indicated above it works fine.

       

      Any help is appreciated. I am out of thoughts on how to fix it.

        • 1. Re: rich:editor and rich:fileUpload after dynamic ui:include display problem
          michpetrov

          You're right that the css and js are missing, this is unfortunately how JSF works. It only loads the resources that are needed and with the dynamic include it doesn't know what resources will be needed.

           

          One way around it is to force-load the resources by including another editor/fileUpload component on the page (that isn't part of the include) and hiding it. You can also specify

          <context-param>
              <param-name>org.richfaces.resourceOptimization.enabled</param-name>
              <param-value>true</param-value>
          </context-param>
          

          in web.xml. This will load a css/js file that contains all resources so they will always be available. This still won't work for editor though, its resources are separate.

          • 2. Re: rich:editor and rich:fileUpload after dynamic ui:include display problem
            timpii

            Thank you Michal,

             

            I followed both of your suggestions successfully - adding the context-param fixed the rich:fileUpload, adding a <rich:editor rendered="false" /> in the line before the <ui:include fixed the rich:editor. So now the js and css work.

            Tim