2 Replies Latest reply on Apr 24, 2009 12:53 AM by Ilya Shaikovsky

    a4j:commandButton - action not performed on click

    Gaurav Arora Newbie

      Hi,
      I'm new to seam and jsf and I have written a very simple page. In the page I have added a a4j command button which is supposed to call a method of the page. However, no method is called after the click is performed. I tried to see if the AJAX request is sent at all using firebug but no request is generated.

      The view:

      <!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:s="http://jboss.com/products/seam/taglib"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:rich="http://richfaces.org/rich"
       xmlns:a4j="http://richfaces.org/a4j"
       template="layout/template.xhtml">
      
      <ui:define name="body">
      
       <rich:panel>
       <div class="results"><h:outputText
       value="hmm, something's not right"
       rendered="#{empty reactionList}" />
       <rich:dataTable
       id="reactionList" var="simpleReaction"
       value="#{reactionList}"
       rendered="#{not empty reactionList}">
      
       // ..columns and headers
      
       <rich:column>
       #{simpleReaction.processedMaterial.sellPrice}
       <a4j:commandButton action="#{simpleReactionList.zxy}" value="abcd" />
       </rich:column>
       </rich:dataTable>
       </div>
       </rich:panel>
      </ui:define>
      
      </ui:composition>
      
      


      SimpleReactionList.java:

      @Name("simpleReactionList")
      public class SimpleReactionList {
      
      @Logger
      private Log log;
      
      @In(value = "entityManager")
      private EntityManager em;
      
      @In
      StatusMessages statusMessages;
      
      @DataModel
      private List<SimpleReaction> reactionList;
      
      @Factory("reactionList")
      public void simpleReactionList() {
       log.info(getClass() + " initialized");
       List<ProcessedMaterial> processedMaterialList = em.createQuery("select m from ProcessedMaterial m").getResultList();
       reactionList = new ArrayList<SimpleReaction>();
      // do some other stuff
      
      }
      
      public void zxy() {
       log.info("--------------------------------------------------------------------------");
       log.info("--------------------------------------------------------------------------");
      }
      }
      


      All the data displays perfectly. Only the ajax request doesn't go out.
      Could someone give me an idea as to what i'm doing wrong? This is just a test app i'm writing to understand seam, jsf and richfaces.