3 Replies Latest reply on May 25, 2009 6:18 AM by Varun Goyal

    java script error "a4j is undefined"

    Varun Goyal Newbie



      Hi,

      I am having rich faces 3.1.6 version in our environment compatible with JSF 1.1.

      below is the code snippet. On clicking the page, the java script error "a4j is undefined. I have copied all rich faces components jar files to richfaces-api-3.1.6.GA.jar, richfaces-impl-3.1.6.GA.jar and richfaces-ui-3.1.6.GA.jar
      in the classpath.

      Regards,
      Varun

      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <ui:composition 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:t="http://myfaces.apache.org/tomahawk"
      xmlns:custom="http://java.sun.com/blueprints/ajax/radiobutton"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:a4j="http://richfaces.org/a4j"
      template="template.xhtml">



      <!-- Meta Data -->
      <!-- is used for auto refresh of the current page -->
      <!-- <ui:define name="metadata">
      <meta http-equiv="refresh" content="15; url=alarmMgtMain.jsf" />
      </ui:define>
      -->



      <!-- Header Area -->
      <ui:define name="header">
      <f:loadBundle basename="com.cntdb.dbm.messages" var="dbm_messages"/>
      <h1><h:outputText value="#{dbm_messages['header_alarmgt']}" /></h1>

      </ui:define>

      <!-- Message Area -->
      <ui:define name="messages">
      <f:loadBundle basename="com.cntdb.dbm.messages" var="dbm_messages"/>
      </ui:define>

      <!-- Content Area -->
      <ui:define name="content">
      <f:view>
      <f:loadBundle basename="com.cntdb.dbm.messages" var="dbm_messages"/>

      <h:panelGroup id="dbmAlarmMgtMain_panel">
      <h:form id="form">

      <t:message id="exception" for="hidden" showDetail="true" showSummary="false" replaceIdWithLabel="true" detailFormat="{0}"/>
      <h:inputHidden id="hidden" value="dummy"/>


      <h:outputText id="message" value="#{alarmMgtBackingBeanImpl.msg}" styleClass="info"/>







      <h:outputLabel for="alarm_type"
      value="#{dbm_messages['txt_alarm_type']}"/>





      <h:selectOneMenu id="alarm_type" value="#{alarmMgtBackingBeanImpl.selectedAlarmType}" required="true"
      valueChangeListener="#{alarmMgtMain.alarmTypeStatusChange}" onchange="submit()">
      <f:selectItems value="#{alarmMgtMain.alarmTypes}" />
      </h:selectOneMenu>







      <t:div styleClass="entry" rendered="#{not empty alarmMgtMain.alarmResultWrappers}" >


        #{dbm_messages['hf_alarmmgt']}  



      <!-- Table of existing alarms results -->

      <rich:dataTable id="alarmsTable"
      styleClass="scrollerTable"
      headerClass="standardTable_Header"
      footerClass="standardTable_Header"
      rowClasses="table_RowSingleCenter"
      columnClasses="select_Column,standardTable_Column,standardTable_Column,standardTable_Column,standardTable_Column,standardTable_Column"
      var="pAlarmResult"
      value="#{alarmMgtMain.alarmResultWrappers}"
      border="1"
      >
      <rich:column>
      <!--h:commandLink action="#{alarmMgtMain.selectAlarmNumber}">
      <f:param name="alarm_number" value="#{pAlarmResult.alarmNumber}"/-->
      <h:graphicImage value="#{pAlarmResult.path}" title="#{dbm_messages['txt_pressToSel']}" style="border:0px;">
      <f:param name="alarm_number" value="#{pAlarmResult.alarmNumber}"/>
      <a4j:support event="onclick" reRender="alarmsTable" action="#{alarmMgtMain.selectAlarmNumber}"/>
      </h:graphicImage>
      <!--/h:commandLink-->
      </rich:column>

      <rich:column>
      <f:facet name="header">
      <h:outputText value="#{dbm_messages['ch_alarm_number']}" />
      </f:facet>
      <h:outputText value="#{pAlarmResult.alarmNumber}" />
      </rich:column>

      <rich:column>
      <f:facet name="header">
      <h:outputText value="#{dbm_messages['ch_alarm_severity']}" />
      </f:facet>
      <h:outputText value="#{pAlarmResult.alarmSeverity}" />
      </rich:column>

      <rich:column>
      <f:facet name="header">
      <h:outputText value="#{dbm_messages['ch_reg_exp']}" />
      </f:facet>
      <h:outputText value="#{pAlarmResult.regExp}" />
      </rich:column>

      <rich:column>
      <f:facet name="header">
      <h:outputText value="#{dbm_messages['ch_alarm_state']}" />
      </f:facet>
      <h:graphicImage value="#{pAlarmResult.activePath}" style="border:0px;"/>
      </rich:column>
      </rich:dataTable>



      </t:div>

      <t:div styleClass="entry" style="height:160px;" rendered="#{empty alarmMgtMain.alarmResultWrappers}">


        #{dbm_messages['hf_alarmmgt']}  


      <h:outputLabel value="#{dbm_messages['inf_noalarmtype']}"/>


      </t:div>


      <!-- Button Area -->

      <h:commandButton id="btnModify" action="#{alarmMgtMain.modify}" value="#{dbm_messages['btn_modify']}" disabled="#{alarmMgtBackingBeanImpl.modifyDisabled}" class="modifyButton" style="float:left; margin-left:30px;"/>
      <h:commandButton action="#{alarmMgtMain.restartFMAgent}" value="#{dbm_messages['btn_fmAgent']}" disabled="#{alarmMgtBackingBeanImpl.fmAgentDisabled}" class="fmagentButton" style="float: left; margin-left: 30px;"/>
      <h:commandButton action="#{alarmMgtMain.scan}" value="#{dbm_messages['btn_scan']}" disabled="#{alarmMgtBackingBeanImpl.scanDisabled}" class="scanButton" style="float: left; margin-left: 30px; margin-right: 30px;"/>

      <h:inputHidden id="reset" value="#{dbmJobMainBB.reset}"/>

      </h:form>

      <h:form id="helpForm">

      <h:commandLink>

      <h:graphicImage value="img/help_button.gif" alt="Press to get context-sensitive help!" style="margin-top:41px; border-style:none;"/>

      </h:commandLink>

      </h:form>
      </h:panelGroup>
      </f:view>
      </ui:define>

      </ui:composition>

        • 1. Re: java script error
          Ilya Shaikovsky Master

          do you defined filter in web.xml?

          P.S. do not forget to wrap code snippets to the proper BBCode tags. It's unreadable.

          • 2. Re: java script error
            Varun Goyal Newbie

            Please find web.xml as follows:

            <?xml version="1.0" encoding="UTF-8"?>
            <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <!-- The Sun dtd defines an explicit order for the different tags! -->
            <!-- The order is:
            ELEMENT web-app (icon?, display-name?, description?, distributable?,
            context-param*, filter*, filter-mapping*, listener*, servlet*,
            servlet-mapping*, session-config?, mime-mapping*, welcome-file-list?,
            error-page*, taglib*, resource-env-ref*, resource-ref*, security-constraint*,
            login-config?, security-role*, env-entry*, ejb-ref*, ejb-local-ref*)
            -->


            <!-- Seam context params -->

            <!-- lw026449, 06.06.2007, RL2122: 120 minutes conversation timeout; value in millis -->
            <context-param>
            <param-name>org.jboss.seam.core.manager.conversationTimeout</param-name>
            <param-value>7200000</param-value>
            </context-param> <!-- TODO: Not working yet unless you disable repository scoped classloading by deleting jboss-app.xml -->
            <!-- context-param&gt;
            &lt;param-name&gt;org.jboss.seam.core.init.clientSideConversations&lt;/param-name&gt;
            &lt;param-value&gt;true&lt;/param-value&gt;
            &lt;/context-param-->

            <!-- Facelets context params -->

            <context-param>
            <!-- false to allow seam exception handling -->
            <param-name>facelets.DEVELOPMENT</param-name>
            <param-value>false</param-value>
            </context-param>

            <context-param>
            <param-name>facelets.SKIP_COMMENTS</param-name>
            <param-value>true</param-value>
            </context-param>

            <!-- Seam context params -->

            <context-param>
            <!-- seam debug page (requires seam-debug.jar!): http://:8080/dbmcntdb/debug.jsf -->
            <param-name>org.jboss.seam.core.init.debug</param-name>
            <param-value>false</param-value>
            </context-param>

            <context-param>
            <param-name>org.jboss.seam.core.init.jndiPattern</param-name>
            <param-value>#{ejbName}/local</param-value>
            </context-param>

            <context-param> <!-- true for MyFaces 1.1.1 (part of JBoss 4.0.4.GA), false for 1.1.3 -->
            <param-name>org.jboss.seam.core.init.myFacesLifecycleBug</param-name>
            <param-value>false</param-value>
            </context-param>

            <!-- MyFaces context params -->

            <context-param>
            <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
            <param-value>client</param-value>
            </context-param>

            <context-param>
            <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
            <param-value>.xhtml</param-value>
            </context-param>

            <context-param>
            <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
            <param-value>true</param-value>
            </context-param>

            <context-param>
            <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
            <param-value>true</param-value>
            </context-param>

            <context-param>
            <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
            <param-value>false</param-value>
            </context-param>

            <context-param>
            <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
            <param-value>false</param-value>
            </context-param>

            <!-- MyFaces 1.1.3 context params -->

            <context-param>
            <param-name>org.apache.myfaces.ADD_RESOURCE_CLASS</param-name>
            <param-value>org.apache.myfaces.renderkit.html.util.DefaultAddResource</param-value>
            </context-param>

            <context-param>
            <param-name>org.apache.myfaces.CHECK_EXTENSIONS_FILTER</param-name>
            <param-value>true</param-value>
            </context-param>

            <!-- MyFaces 1.1.5 context params -->
            <context-param>
            <param-name>org.apache.myfaces.redirectTracker.MAX_REDIRECTS</param-name>
            <param-value>20</param-value>
            </context-param>
            <context-param>
            <param-name>org.apache.myfaces.redirectTracker.POLICY</param-name>
            <param-value>org.apache.myfaces.custom.redirectTracker.policy.NoopRedirectTrackPolicy</param-value>
            </context-param>
            <context-param>
            <param-name>org.apache.myfaces.READONLY_AS_DISABLED_FOR_SELECTS</param-name>
            <param-value>true</param-value>
            </context-param>
            <context-param>
            <param-name>org.apache.myfaces.RESOURCE_VIRTUAL_PATH</param-name>
            <param-value>/faces/myFacesExtensionResource</param-value>
            </context-param>




            <!-- Tomahawk context params -->
            <context-param>
            <param-name>facelets.LIBRARIES</param-name>
            <param-value>/WEB-INF/tomahawk.taglib.xml;/WEB-INF/sandbox.taglib.xml;/WEB-INF/progressbar.taglib.xml</param-value>
            </context-param>

            <!-- richfaces -->


            <display-name>RichFaces Filter</display-name>
            <filter-name>richfaces</filter-name>
            <filter-class>org.ajax4jsf.Filter</filter-class>



            <!-- Seam master filter -->
            <!-- Enables seam exception filter, seam redirect and multipart filter which can be configured via components.xml -->

            <!-- richfaces -->
            <filter-mapping>
            <filter-name>richfaces</filter-name>
            <url-pattern>*.seam</url-pattern>
            </filter-mapping>


            <filter-name>SeamFilter</filter-name>
            <filter-class>org.jboss.seam.web.SeamFilter</filter-class>


            <!-- MyFaces extensions filter -->


            <filter-name>MyFacesExtensionsFilter</filter-name>
            <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
            <init-param>
            <param-name>maxFileSize</param-name>
            <param-value>20m</param-value>
            </init-param>


            <!-- Seam filter mapping -->

            <filter-mapping>
            <filter-name>SeamFilter</filter-name>
            <url-pattern>/*</url-pattern>
            </filter-mapping>

            <!-- MyFaces filter mapping -->

            <!-- extension mapping for adding &lt;script/&gt;, &lt;link/&gt;, and other resource tags to JSF-pages -->
            <filter-mapping>
            <filter-name>MyFacesExtensionsFilter</filter-name>
            <url-pattern>*.jsf</url-pattern>
            </filter-mapping>

            <!-- extension mapping for serving page-independent resources (javascript, stylesheets, images, etc.) -->
            <filter-mapping>
            <filter-name>MyFacesExtensionsFilter</filter-name>
            <url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
            </filter-mapping>


            <!-- Seam listener -->


            <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>


            <!-- MyFaces listener -->


            <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>


            <!-- Faces servlet -->


            <servlet-name>Token Servlet</servlet-name>
            <servlet-class>com.cntdb.dbm.login.TokenServlet</servlet-class>



            <servlet-name>Faces Servlet</servlet-name>
            <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
            <load-on-startup>1</load-on-startup>


            <servlet-name>StartUp</servlet-name>
            <servlet-class>com.cntdb.dbm.alarmmgt.CompareXMLFiles</servlet-class>
            <load-on-startup>1</load-on-startup>

            <!-- Faces Servlet Mapping -->

            <servlet-mapping>
            <servlet-name>Token Servlet</servlet-name>
            <url-pattern>/token</url-pattern>
            </servlet-mapping>
            <servlet-mapping>
            <servlet-name>Faces Servlet</servlet-name>
            <url-pattern>*.jsf</url-pattern>
            </servlet-mapping>
            <servlet-mapping>
            <servlet-name>Faces Servlet</servlet-name>
            <url-pattern>*.faces</url-pattern>
            </servlet-mapping>
            <servlet-mapping>
            <servlet-name>Faces Servlet</servlet-name>
            <url-pattern>/faces/*</url-pattern>
            </servlet-mapping>

            <!-- http session timeout 2 hours (120 min) -->
            <session-config>
            <session-timeout>120</session-timeout>
            </session-config>
            <error-page>
            <error-code>500</error-code>
            /dbmError500.jsf
            </error-page>
            <error-page>
            <error-code>501</error-code>
            /dbmError501.jsf
            </error-page>
            <error-page>
            <error-code>502</error-code>
            /dbmError502.jsf
            </error-page>
            <error-page>
            <error-code>503</error-code>
            /dbmError503.jsf
            </error-page>
            <error-page>
            <error-code>504</error-code>
            /dbmError504.jsf
            </error-page>
            <error-page>
            <error-code>505</error-code>
            /dbmError505.jsf
            </error-page>

            </web-app>

            • 3. Re: java script error
              Varun Goyal Newbie

              Can anyone help me in resolving the issue? I would really appreciate the help.