0 Replies Latest reply on Sep 16, 2009 5:45 AM by JLuis -

    How to bound ajaxListener tag with the ajaxListener method

    JLuis - Newbie

      Hi,
      I don't understand why this <a4j:ajaxListener> example doesn't work:

      <rich:panel>
       <f:facet name="header">Using a4j:actionListener</f:facet>
       <a4j:commandButton value="Submit" reRender="#{ajaxBean.areas}">
       <a4j:ajaxListener type="echo.AjaxBean"/>
       </a4j:commandButton>
      </rich:panel>
      <h:panelGrid>
       <h:outputText id="id1" value="id1"/>
       <h:outputText id="id2" value="id2"/>
      </h:panelGrid>
      


      package echo;
      
      import java.util.HashSet;
      import java.util.Set;
      
      import org.ajax4jsf.event.AjaxEvent;
      
      public class AjaxBean implements org.ajax4jsf.event.AjaxListener{
      
       private Set<String> areas = new HashSet<String>();
      
       public Set<String> getAreas() {
       return areas;
       }
      
       public void setAreas(Set<String> areas) {
       this.areas = areas;
       }
      
       public void processAjax(AjaxEvent event) {
       System.out.println("Update IDs of components to be rerendered");
       areas.add("id1");
       areas.add("id2");
       }
      
      }
      


      I will thank any suggestion...