4 Replies Latest reply on Dec 1, 2011 6:43 AM by Stian Thorgersen

    rich:dataTable value called when not required with a4j:poll

    Stian Thorgersen Novice

      I have a problem where parts of my beans are invoked by an a4j:poll even though they shouldn't be as they aren't specified in the render attribute. I've found out that this is caused by rich:dataTable being processed even though it shouldn't. If I switch to h:dataTable everything works fine.


      My test view looks like this:


      <?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"
                          <a4j:poll id="ajaxChecker" render="ajaxCount" interval="1000" />
                  <rich:dataTable var="c" value="#{ajax.ajaxCount}" id="ajaxCount">
                                    <h:outputText value="#{c}" />
                  <rich:dataTable var="c" value="#{ajax.count}" id="count">
                                    <h:outputText value="#{c}" />


      and the bean is:


      public class Ajax implements Serializable
          private static final long serialVersionUID = 1L;
          private volatile int ajaxCount = 0;
          private volatile int count = 0;
          public List<Integer> getAjaxCount()
              return Collections.singletonList(ajaxCount++);
          public boolean isEvent()
              return ajaxCount % 10 == 0;
          public List<Integer>  getCount()
              return Collections.singletonList(count++);


      From the output on the server I can see that getAjaxCount is called twice and getCount once every second. I'm expecting getAjaxCount to be invoked once every second, and getCount to only be invoked when the page is refreshed.


      It seems to me that this is caused by a bug in rich:dataTable?