4 Replies Latest reply on Dec 13, 2010 9:04 AM by nbelaevski

    Load RichFaces resources when a page is loaded trough an AJAX call.

    cmastrantono

      Hi everyone... I think I have a problem a little complex.

       

      To make it easier, I have a page called index.jsp (I'm using JSF) with only a OutputLink and a DIV with id="myBlock". When the user clicks on the OutputLink, I use an AJAX call to send a request to the server looking for the "richPage.jsf".

       

      When the request is solved, the response given by the server is embebed to the page in this way:

       

      document.getElementById("myBlock").innerHTML = req.responseText;

       

      Everything goes well and looks fine, until I tried to do some stuff with the RichFaces components that were suposed to be on the page. Actually, the components are rendered on the page, but are unusable. It's like they are there, but with no behavior.

       

      I think the problem is basically with the JS used by the components (e.g. Rich:Calendar or Rich:TabPanel). My guess is that no resources are loaded when I make that call.

       

      What I tried so far?

       

      On the "index.jsp" and "richPage.jsp" stated (with no result):

           <a4j:loadScript src="resource:///org/ajax4jsf/framework.pack.js" />

           <a4j:loadStyle src="resource:///org/richfaces/ui.pack.js" />

       

      Web.XML

           <context-param>

          <param-name>org.richfaces.LoadScriptStrategy</param-name>

          <param-value>NONE or ALL</param-value>

           </context-param>

       

      After these tests, the TabPanel and the Calendar are unusable...

       

      I still believing that resources that were suposed to be loaded when "richPage.jsp" is invoked, aren't loaded... so I´m wondering if there is any way to load them manually...

       

      Anyone have some guess??

      <f:view locale="es">
      <h:form id="formPrincipal">
      <h:outputLink id="misPendientes" value="#" onclick="javascript:abrirVistaNew('vistas/view.jsf?viewId=2&searchString=');"  >
      <b><h:outputText value="ABRIR!"/></b>
      <rich:toolTip>Un Tooltip</rich:toolTip>
      </h:outputLink>
      <div>---------------------------------------------------------</div>
      <t:div id="frameContenidos">
      <div id="frameContenido"></div>
      </t:div>
      </h:form>
      </f:view>
        • 1. Re: Load RichFaces resources when a page is loaded trough an AJAX call.
          cmastrantono

          No one? No ideas?

          • 2. Re: Load RichFaces resources when a page is loaded trough an AJAX call.
            nbelaevski

            Hi,

             

            Resources should be loaded fine on index.jsp when you used a4j:loadScript - please check if there are any problems loading them.

            Also try this:

             

            <context-param>

                <param-name>org.richfaces.LoadStyleStrategy</param-name>

                <param-value>ALL</param-value>

            </context-param>

            <context-param>

                <param-name>org.richfaces.LoadScriptStrategy</param-name>

                <param-value>ALL</param-value>

            </context-param>

            <context-param>
                <param-name>org.richfaces.LoadStyleStrategy</param-name>
                <param-value>ALL</param-value>
            </context-param>
            <context-param>
                <param-name>org.richfaces.LoadScriptStrategy</param-name>
                <param-value>ALL</param-value>
            </context-param>
            1 of 1 people found this helpful
            • 3. Re: Load RichFaces resources when a page is loaded trough an AJAX call.
              cmastrantono

              Thanks for the answer...

               

              Ok, in the case I decide to use a4j:loadScript ... I don´t know which scripts are suposed to be loaded for RichFaces.

               

              I mean, on the top of the jsp page I have "<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>" ... there is anything else I could declare explicitly to import some RichFaces resources like JS and CSS ???

               

              Thanks in advance.

               

              Cristian.

              Ok, in the case I decide to use a4j:loadScript ... I don´t know which scripts are suposed to be loaded for RichFaces.
              I mean, on the top of the jsp page I have "<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>" ... there is anything else I could declare explicitly to import some RichFaces resources like JS and CSS ???
              Thanks in advance.

              Cristian.

              Ok, in the case I decide to use a4j:loadScript ... I don´t know which scripts are suposed to be loaded for RichFaces.

               

              I mean, on the top of the jsp page I have "<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>" ... there is anything else I could declare explicitly to import some RichFaces resources like JS and CSS ???

               

              Thanks in advance.

               

              Cristian.

              • 4. Re: Load RichFaces resources when a page is loaded trough an AJAX call.
                nbelaevski

                Cristian,

                 

                These resources combine RF JS resources, so should be enough:

                 

                     <a4j:loadScript src="resource:///org/ajax4jsf/framework.pack.js" />

                     <a4j:loadStyle src="resource:///org/richfaces/ui.pack.js" />

                1 of 1 people found this helpful