1 Reply Latest reply on May 10, 2013 2:53 AM by jigg4

    Possible Reasons for "ReferenceError: jsf is not defined"

    jigg4 Newbie

      Hello everyone,

       

      I am trying to run a simple webpage with a simple RichFaces component and i get the following error: "ReferenceError: jsf is not defined".

      The component which I am using to test whether richfaces is working or not is : rich:select enableManualInput="true". The weird part is, that the component is actually working, but firebug is still telling me that i have the told error!

      I am running tomcat 7, myfaces and latest RichFaces version. I have also added sac 1.3, cssparser and guava 10.0.1.

      Which reasons can this kind of error have?

       

      My simple page:

       

      <html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:c="http://java.sun.com/jsp/jstl/core"
          xmlns:t="http://myfaces.apache.org/tomahawk"
          xmlns:his="http://www.his.de/jsf" 
          xmlns:a4j="http://richfaces.org/a4j"
          xmlns:rich="http://richfaces.org/rich">
      
      
      <h:head>
          <title>RichFaces Test</title>
      
      </h:head>
      <h:body>
          <h:form>
              <p>test</p>
              <rich:select enableManualInput="true"
                  defaultLabel="start typing for select">
                  <f:selectItem itemValue="0" itemLabel="Berlin" />
                  <f:selectItem itemValue="1" itemLabel="Berge" />
                  <f:selectItem itemValue="2" itemLabel="London" />
                  <f:selectItem itemValue="3" itemLabel="Moskau" />
                  <f:selectItem itemValue="4" itemLabel="Long Island" />
                  <f:selectItem itemValue="4" itemLabel="Bering" />
                  <f:selectItem itemValue="4" itemLabel="Loehne" />
              </rich:select>
          </h:form>
      
      </h:body>
      </html>
      
        • 1. Re: Possible Reasons for "ReferenceError: jsf is not defined"
          jigg4 Newbie

          Ok I watched into my header in firebug of the generated site and found this two JavaScripts:

          1) jsf.js.faces?ln=javax.faces&stage=Development

          2) jsf.js.faces?ln=org.apache.myfaces.core.api

           

          After 2) i can see all the richfaces JS. So actually 1) and 2) should be loaded before the richfaces JS?

          After setting breakpoints in 2) on line 40 where it says: var jsf = new function() {.......

          And also a breakpoint in the richfaces-queue.js.faces, where the jsf function is used, i noticed that the richfaces-queue.js.faces is loaded BEFORE the jsf.js, which doesnt make any sense to me.

          Any ideas why this is happening guys?

           

           

           

          EDI: I have solved this issue by editing a param in my web.xml:

           

          <context-param>

                  <param-name>org.apache.myfaces.USE_MULTIPLE_JS_FILES_FOR_JSF_UNCOMPRESSED_JS</param-name>

                  <param-value>false</param-value>

          </context-param>

           

          This one was set to true, which caused the above errors. By setting it to false solves the issue, just in case anybody runs into the same problem