1 Reply Latest reply on Nov 21, 2007 8:56 PM by Sergey Smirnov

    Richfaces sample using <a4j:support> not working

    Kishore R Newbie

      I have been having problems getting the <a4j:support> tag to work for me. So I decided to try out an example provided with the Richfaces distro.

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.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:f="http://java.sun.com/jsf/core"
       xmlns:s="http://jboss.com/products/seam/taglib" lang="en"
       xmlns:a4j="http://richfaces.org/a4j"
       xmlns:rich="http://richfaces.org/rich">
      <body>
      <h:panelGroup>
       <a4j:keepAlive beanName="rsBean2" />
       <h:form>
       <h:inputText size="4" label="First Addent" value="#{rsBean2.addent1}">
       <a4j:support event="onkeyup" reRender="btn2" />
       </h:inputText>
       <h:outputText value="+"/>
       <h:inputText size="4" label="Second Addent" value="#{rsBean2.addent2}">
       <a4j:support event="onkeyup" reRender="btn2" />
       </h:inputText>
       <a4j:commandButton style="margin:0 5px" id="btn2" action="#{rsBean2.doSum}"
       value="=" reRender="sum2"
       disabled="#{rsBean2.addent1 == null or rsBean2.addent2==null}"/>
       <h:outputText id="sum2" value="#{rsBean2.sum}" />
       </h:form>
       <a4j:outputPanel ajaxRendered="true">
       <h:messages />
       </a4j:outputPanel>
      </h:panelGroup>
      </div>
      </body>
      </html>
      

      and the backing bean
      import org.jboss.seam.annotations.Name;
      
      @Name("rsBean2")
      public class RSBean {
       private Integer addent1;
       private Integer addent2;
       private Integer sum;
      
       public String doSum() {
       sum = new Integer((addent1 != null ? addent1.intValue() : 0) + (addent2 != null ? addent2.intValue() : 0));
       return null;
       }
      
       public Integer getAddent1()
       {
       return addent1;
       }
      
       public void setAddent1(Integer addent1)
       {
       this.addent1 = addent1;
       }
      
       public Integer getAddent2()
       {
       return addent2;
       }
      
       public void setAddent2(Integer addent2)
       {
       this.addent2 = addent2;
       }
      
       public Integer getSum()
       {
       return sum;
       }
      
       public void setSum(Integer sum)
       {
       this.sum = sum;
       }
      
      }
      


      I tried the example with all the major browsers.
      I dont see the <a4j:support> events being fired at all and the button stays disabled. What am I doing wrong here? Any ideas highly appreciated.

      Thanks in advance