5 Replies Latest reply on Nov 14, 2007 10:59 AM by Carlos Garcia

    A4J is not defined

    Sanjeev Koppal Newbie

      A4J is not defined
      getElementsByTagName("INPUT", span#ajax-view-state)a4j_3_1_0org.ajax... (line 35)
      processResponse(Object _query=Object options=Object containerId=_viewRoot)a4j_3_1_0org.ajax... (line 69)
      getParseErrorText()

      I am getting this error where ever i am using a4j:commandButton or a4j:commandLink.
      I am using Facelets 1.1.1
      Following is my set up
      Jars used:
      richfaces-api-3.1.0, richfaces-impl-3.1.0, richfaces-ui-3.1.0

      web.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
      <context-param>
      <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
      <param-value>.xhtml</param-value>
      </context-param>
      <!-- Special Debug Output for Development -->
      <context-param>
      <param-name>facelets.DEVELOPMENT</param-name>
      <param-value>true</param-value>
      </context-param>
      <context-param>
      <param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
      <param-value>true</param-value>
      </context-param>
      <!-- ######### End Facelets Development context-params ########## -->
      <!-- Bring in custom tag libraries -->
      <context-param>
      <param-name>facelets.LIBRARIES</param-name>
      <param-value>/WEB-INF/facelets/tags/oes.taglib.xml;
      /WEB-INF/facelets/tags/oesfn.taglib.xml;
      /WEB-INF/facelets/tags/tomahawk.taglib.xml;</param-value>
      </context-param>
      <!-- Bring in the spring configuration files /WEB-INF/config/oes-env-Configuration.xml-->
      <context-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>/WEB-INF/config/oes-applicationContext.xml,
      /WEB-INF/config/oes-service-beans.xml</param-value>
      </context-param>
      <!-- Standard settings from here on-->
      <context-param>
      <param-name>org.apache.myfaces.SECURITY_CONTEXT</param-name>
      <param-value>com.ri.app.oes.util.security.OESSecurityContextImpl</param-value>
      </context-param>
      <context-param>
      <param-name>javax.faces.CONFIG_FILES</param-name>
      <param-value>/WEB-INF/config/faces-config.xml,
      /WEB-INF/config/faces-beans.xml,
      /WEB-INF/config/faces-navigation-oes.xml</param-value>
      </context-param>
      <context-param>
      <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
      <param-value>client</param-value>
      </context-param>
      <context-param>
      If true, a javascript function will be rendered that is able to restore the
      former vertical scroll on every request. Convenient feature if you have pages
      with long lists and you do not want the browser page to always jump to the top
      if you trigger a link or button action that stays on the same page. Default:
      "false"
      <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
      <param-value>true</param-value>
      </context-param>
      <!-- RICH Faces Integration -->
      <context-param>
      <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
      <param-value>com.sun.facelets.FaceletViewHandler</param-value>
      </context-param>

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

      <filter-mapping>
      <filter-name>richfaces</filter-name>
      <servlet-name>Faces Servlet</servlet-name>
      REQUEST
      FORWARD
      INCLUDE
      </filter-mapping>
      <!-- END OF Parameters -->
      <error-page>
      <error-code>500</error-code>
      /error.jsp
      </error-page>
      <!-- All Listeners -->

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

      <!--
      <listener-class>
      org.springframework.web.util.Log4jConfigListener
      </listener-class>

      -->

      <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>

      <!-- All Servlets -->

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


      <servlet-name>SpringContext</servlet-name>
      <servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
      <load-on-startup>1</load-on-startup>

      <!-- extension mapping -->
      <servlet-mapping>
      <servlet-name>Faces Servlet</servlet-name>
      <url-pattern>*.jsf</url-pattern>
      </servlet-mapping>
      <!-- All Filters -->

      This filter overwrites OpenSessionInViewFilter to make flush
      mode to COMMIT.
      <filter-name>applicationSessionFilter</filter-name>
      <filter-class>com.ri.app.oes.view.filter.ApplicationSessionFilter</filter-class>

      <filter-mapping>
      <filter-name>applicationSessionFilter</filter-name>
      <url-pattern>*.jsf</url-pattern>
      </filter-mapping>
      <filter-mapping>
      <filter-name>applicationSessionFilter</filter-name>
      <url-pattern>*.xhtml</url-pattern>
      </filter-mapping>
      <filter-mapping>
      <filter-name>applicationSessionFilter</filter-name>
      <url-pattern>*.jsp</url-pattern>
      </filter-mapping>

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

      <filter-mapping>
      <filter-name>MyFacesExtensionsFilter</filter-name>
      <url-pattern>*.jsf</url-pattern>
      </filter-mapping>

      Checks for Http session of logged in user
      <filter-name>httpSessionFilter</filter-name>
      <filter-class>com.ri.app.oes.view.filter.HttpSessionFilter</filter-class>

      <filter-mapping>
      <filter-name>httpSessionFilter</filter-name>
      <url-pattern>*.jsf</url-pattern>
      </filter-mapping>
      <filter-mapping>
      <filter-name>httpSessionFilter</filter-name>
      <url-pattern>*.jsp</url-pattern>
      </filter-mapping>
      <welcome-file-list>
      <welcome-file>index.jsp</welcome-file>
      </welcome-file-list>
      </web-app>


      Xhtml
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <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:ri="http://remedyinteractive.com/jsf"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jstl/core"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich" >




      <ui:composition template="/WEB-INF/facelets/layout/oes-popup-template.xhtml"
      >
      <ui:define name="title">
      OES- ${activityBean.create?'Add':'Edit'} ${activityBean.name}: ${addActivityBean.riskName}
      </ui:define>
      <!-- Page title for this page -->
      <ui:define name="pagetitle">
      <ri:riTitleBar pageType="${jobDetailBean.jobName}" subject="${activityBean.name}: ${addActivityBean.riskName} Risk" printer="false"/>
      </ui:define>
      <ui:define name="body">
      <!--
      function closeTaskPopup(cancel,close) {
      alert("Inside add new task close "+close+" cancel "+cancel);

      if(cancel==1){
      top.f_dialogClose();
      }
      if(close==1){
      parent.AddActivityId.location.reload();
      top.f_dialogClose();

      }
      return false;
      }
      //-->


      <h:form id="taskDetailForm" >

      <!-- Display all the Risk types -->




      ${taskBean.riskTypeName} Risks :&#160;&#160;&#160;




      <h:selectOneMenu id="task" styleClass="dropdown" disabled="${taskBean.editTask}"
      value="#{taskBean.selectedTask}"
      valueChangeListener="#{taskBean.changeTaskEvent}"
      immediate="true" onchange="submit();" >
      <f:selectItems value="#{taskBean.modulesForTask}" />
      </h:selectOneMenu>



      <!-- Description of Risk -->



      Description :&#160;&#160;&#160;


      <a4j:outputPanel ajaxRendered="true">
      <h:message for="TaskDescription" style="color:red" />
      </a4j:outputPanel>
      <h:inputTextarea id="TaskDescription" styleClass="description" style="width:250px;" value="#{taskBean.description}" rows="3"
      cols="30" >
      <f:validateLength maximum="500"/>

      <a4j:support event="onkeyup" />
      </h:inputTextarea>




      <!-- Displays Issues Categories and related issues -->
      <c:forEach items="${taskBean.issueCatAndIssueBean}" var="ics">



      <h:outputLabel id="_${ics.issueCategory.label}_lbl"
      value="${ics.issueCategory.value}" />:&#160;&#160;&#160;



      <h:selectOneMenu styleClass="dropdown" id="issues_${ics.issueCategory.label}"
      value="#{ics.selectedIssue}" >
      <f:selectItems value="#{ics.issues}" />
      </h:selectOneMenu>


      </c:forEach>





      <a4j:commandButton styleClass="buttonbg" id="btnTaskCancel"
      value="Cancel" onclick="closeTaskPopup(1,0)" />
      &#160;

      <a4j:commandButton styleClass="buttonbg"
      action="#{taskBean.addTask}" id="btnTaskSave"
      value="Save ${taskBean.riskTypeName} Risks"
      oncomplete="closeTaskPopup(0,1)"/>






      </h:form>

      </ui:define>
      </ui:composition>





      Please help ...