3 Replies Latest reply on Oct 31, 2013 7:27 PM by Brian Leathem

    rich:jQuery

    Cole Sobotka Newbie

      Hey!

       

      I'm working on a project that involves migrating from richfaces 3.x.x to 4.3.3 with JSF 2. There are a lot of rich:jQuery tags present inside <h:head>, but they no longer work properly. I am getting "Richfaces/Jquery is not defined" and it looks like the richfaces/jquery javascript files are being included in the body of the page rather than the head.

       

      There's too much code to post on here and make it legible, so here's a quick example of how the elements are structured:

       

      <f:view>

        <html>

          <h:head>

                /* All of the <rich:jQuery> elements are declared in here. */

          </h:head>

          <h:body>

                /* Other richfaces/jquery content that works just fine because it's in the body */

          </h:body>

        </html>

      </f:view>

       

      Is this the intended behavior for richfaces 4? I'm fairly new to richfaces, and it's quite a large code base I'm working with. I'm hoping it's just a bug that's causing all of the needed javascript to be loaded in the body rather than the head. I can provide some actual code snippets if needed.

       

      Thanks!

      Cole

        • 1. Re: rich:jQuery
          Brian Leathem Master

          Can you provide a http://sscce.org/ sample I can run locally?

          • 2. Re: Re: rich:jQuery
            Cole Sobotka Newbie

            Well I'm not sure exactly what you need, but I'm working in a maven project that uses JSF 2.2, Richfaces 4.3.3.Final and servlet-api-2.5.

             

            The following code in a *.xhtml file will give the same Richfaces not defined exception:

             

            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
            <f:view xmlns="http://www.w3.org/1999/xhtml"
                    xmlns:h="http://java.sun.com/jsf/html"
                    xmlns:f="http://java.sun.com/jsf/core"
                    xmlns:rich="http://richfaces.org/rich"
                    xmlns:ui="http://java.sun.com/jsf/facelets"
                    xmlns:a4j="http://richfaces.org/a4j"
                    xmlns:t="http://myfaces.apache.org/tomahawk">
                <html>
                    <h:head>
                      <rich:jQuery selector="#test" query="addClass('tested')" />
                    </h:head>
                    <h:body>
                        <input type="text" id="test" />
                    </h:body>
                </html>
            </f:view>
            

            When the html renders for the client, I can see the richfaces javascript files being included in the body of the document rather than the head. Hopefully this is what you were looking for.

             

            Edit: Is there a certain way to add <code> to these responses? The tag isn't working here for me.

            • 3. Re: Re: rich:jQuery
              Brian Leathem Master

              Sounds like a bug.  Can you file a RichFaces jira issue?

              https://issues.jboss.org/browse/RF

               

              As for embedding code blocks, you'll have to use the GUI toolbar.  Please file a jboss.org jira requesting this feature.  It's much more meaningful to the site ops when these request come from users rather than us.

              https://issues.jboss.org/browse/ORG