4 Replies Latest reply on Dec 1, 2011 11:39 AM by stianst

    h:commandLink doesn't work after a4j:poll has re-rendered it

    stianst

      I have a simple test page that contains a h:form with a single h:commandLink. The form is re-rendered every second with a4j:poll. Once loaded if I click the link before the a4j:poll has re-renderded it, the action is executed. However, if I wait until the a4j:poll has re-rendered it nothing happens when I click the link. If I click the link twice after the a4j:poll has re-rendered it, nothing happens on the first click, but on the second click the action is fired as expected.

       

      I'm using JBoss AS 7.0.2.Final with RichFaces 4.0.0.Final.

       

      page:

      <?xml version="1.0" encoding="utf-8"?>
      <!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" xml:lang="en-US" lang="en-US"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:a4j="http://richfaces.org/a4j"
                xmlns:rich="http://richfaces.org/rich">
      <h:head />
      <body>
                <h:form>
                          <a4j:poll interval="5000" render="form" />
                </h:form>
      
      
                <h:form id="form">
                          <h:commandLink action="#{ajaxTest.submit}" value="submit #{ajaxTest.date}" />
                </h:form>
      </body>
      </html>
      
      

       

      bean:

      @Named
      @RequestScoped
      public class AjaxTest
      {
          public Date getDate()
          {
              return new Date();
          }
      
          public String submit()
          {
              System.out.println("submit");
              return "";
          }
      }