6 Replies Latest reply on Mar 16, 2007 2:36 PM by Sergey Smirnov

    Problem with using the basic <a4j:support>

    Vijaya Kumar Aalati Newbie

      Hi,
      I am new to Ajax4JSF. I am trying to use the basic tag <a4j:support> in my JSF page and it does not seem to work for me. It does not throw any exception or error. It simply does not replicate the data which it is supposed to do. I have the required Jar files (ajax4jsf-1.1.0.jar and oscache-2.3.2.jar) in my application's lib directory and I also added the tag-lib referencing as below :

      <%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>


      Basically I am developing Portal with JSF and MyFaces and my portal/porlets work fine. NO issue with them.

      Below are my web.xml and JSF page code wherein you will see that I have added some filter as recommended in the Developers Guide of a4j from your website. These additions in web.xml are marked starting with <!-- AJAX4JSF START HERE --> and
      ending with <!-- AJAX4JSF END HERE -->.


      <?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">
      <!-- AJAX4JSF START HERE -->

      <display-name>Ajax4jsf Filter</display-name>
      <filter-name>ajax4jsf</filter-name>
      <filter-class>org.ajax4jsf.FastFilter</filter-class>

      <filter-mapping>
      <filter-name>ajax4jsf</filter-name>
      <servlet-name>Faces Servlet</servlet-name>
      REQUEST
      FORWARD
      INCLUDE
      </filter-mapping>
      <!-- AJAX4JSF END HERE -->
      <context-param>
      <param-name>javax.faces.CONFIG_FILES</param-name>
      <param-value>/WEB-INF/faces-config.xml</param-value>
      </context-param>

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


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

      <servlet-mapping>
      <servlet-name>Faces Servlet</servlet-name>
      <url-pattern>*.faces</url-pattern>
      </servlet-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>*.faces</url-pattern>
      </filter-mapping>
      </web-app>




      Also, I am attaching my JSF code below:



      <%@ page language="java" session="true" %>

      <%@ page language="java" pageEncoding="ISO-8859-1"%>
      <%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
      <%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>


      <f:loadBundle basename="altair.adm.login.messages" var="msg"/>

      <portlet:defineObjects/>


      <portlet:actionURL var="loginAction">
      <portlet:param name="command" value="doLogin" />
      </portlet:actionURL>




      ADM Login


      <f:view>

      <h:form id="adm_login_form">
      <h:message for="ADM_USER_ID" />
      <h:message for="ADM_USER_PASSWORD" />
      <h:message for="ADM_USER_DATABASE" />
      h:panelGrid id="adm_login_panel_grid" columns="2">
      <h:outputText value="#{msg.user_id_tag}" />
      <h:inputText value="#{adm_login.uid}" required="true" id="ADM_USER_ID" >
      <a4j:support event="onkeyup" reRender="repeater" />
      </h:inputText>
      <h:outputText id="repeater_msg" value="You are logging in as :: " />
      <h:outputText id="repeater" value="#{adm_login.uid}" />
      <h:outputText value="#{msg.password_tag}" />
      <h:inputSecret value="#{adm_login.pwd}" required="true" id="ADM_USER_PASSWORD"/>
      <h:outputText value="#{msg.database_tag}" />
      <h:selectOneMenu value="" rendered="true" required="true" id="ADM_USER_DATABASE">
      <f:selectItem itemValue="DB1" itemLabel="Database 1" itemDisabled="false"></f:selectItem>
      <f:selectItem itemValue="DB2" itemLabel="Database 2" itemDisabled="false"></f:selectItem>
      </h:selectOneMenu>

      <h:commandButton action="#{adm_login.doLogin}" value="#{msg.login_button_tag}" id="Login" />
      </h:panelGrid>


      </h:form>

      </f:view>