4 Replies Latest reply on Feb 11, 2011 10:50 AM by vatoslokos83

    Add Defer to a4j:JSFunction

    vatoslokos83

      Hi everyone,

       

      I am using version 3.3.0 GA. We did some changes according to some details that we found on the forum but it still doesn't work.

       

      The changes that we done are:

       

      public class FunctionRendererWrapper extends FunctionRenderer {   

          @Override

          public void doEncodeBegin(ResponseWriter writer, FacesContext context, org.ajax4jsf.component.UIAjaxFunction component, ComponentVariables variables ) throws IOException {

              java.lang.String clientId = component.getClientId(context);

      writer.startElement("script", component);

                  getUtils().writeAttribute(writer, "id", clientId );

                  getUtils().writeAttribute(writer, "defer", "defer" );

                              getUtils().writeAttribute(writer, "type", "text/javascript" );

       

       

          }   

      }

       

      and also this one in faces-config.xml:

       

          <renderer>

               <component-family>org.ajax4jsf.components.AjaxFunction</component-family>

               <renderer-type>

                   org.ajax4jsf.components.AjaxFunctionRenderer

               </renderer-type>

               <renderer-class>

                   myPackage.FunctionRendererWrapper

               </renderer-class>

           </renderer>

       

      it seems that the new method that I created isn't invoked.

       

      I will be glad if someone can please help me with this issue.

       

      Thanks.

        • 1. Add Defer to a4j:JSFunction
          nbelaevski

          Hi,

           

          What is renderkit ID used? Where is additional faces-config.xml located?

          • 2. Add Defer to a4j:JSFunction
            vatoslokos83

            First of all thanks for your help.

             

            According to your question it seems that I am not doing something correctly. I don't really know what is renderkit ID and what is the meaning of it.

             

            About the face-config I didn't add another file I just enter it to the exist one where I am located all of our managed-beans\converters\application\factory.

             

            Do I need to add another faces-config file for this issue? In case that yes where I should located it?

             

            I will be glad if you can redirect me to a document that explain what should be done.

             

            Thanks!

            • 3. Add Defer to a4j:JSFunction
              nbelaevski

              Ophir,

               

              As far as I understand the problem is that your renderer is not being registered correctly. This can happen because faces-config.xml is overriden by another one (e.g. the one that comes with RichFaces) or simply not read at all (I assume it's not the case, but anyway). And if you haven't specified explicit renderkit id, then you should be using default - different renderkits are intended to be used for switching between different types of markups, e.g. HTML or WML.

              • 4. Add Defer to a4j:JSFunction
                vatoslokos83

                Thanks I already find the issue and I fixed it.

                 

                It issue was that I didn't know about the <render-kit> tag and I thought that the <renderer> should be in the xml as it.

                 

                Thanks again!