5 Replies Latest reply on Mar 21, 2011 6:08 AM by ilya_shaikovsky

    a4j:poll only fires onces with RF 3.2.0

    cdollar393

      I've been using RF 3.1.x for quite some time and today am testing an update to 3.2.0. My project makes use of a number of a4j:push and a4j:pull to keep track of session data and warn a user of a session that is about to expire. This has worked fine with RF 3.1.4, but with 3.2.0 it seems that my a4j:poll fires one time, and then stops.

      Here is the poll:

      <!-- poll every 60sec -->
      <a4j:poll id="poll" interval="60000" enabled="true" limitToList="true"
       reRender="dashboard, updateStamp" action="#{user.updateStats}"/>
      


      I can see where the updateStats() method is called after the first 60sec, but not again afterwards. I've changed the interval, but that hasn't helped.

      Checking the ajax log I see:
      debug[9:16:34,737]: Header Ajax-Expired not found, search in <meta>
      debug[9:16:34,738]: search for elements by name 'meta' in element #document
      debug[9:16:34,745]: getElementsByTagName found 2
      debug[9:16:34,746]: Find <meta name='Ajax-Update-Ids' content='dashboardForm:poll,dashboardForm:dashboard,dashboardForm:updateStamp,pageFooterForm:j_id2456'>
      debug[9:16:34,746]: Find <meta name='Ajax-Response' content='true'>
      debug[9:16:34,747]: Header Ajax-Update-Ids not found, search in <meta>
      debug[9:16:34,748]: search for elements by name 'meta' in element #document
      debug[9:16:34,753]: getElementsByTagName found 2
      debug[9:16:34,754]: Find <meta name='Ajax-Update-Ids' content='dashboardForm:poll,dashboardForm:dashboard,dashboardForm:updateStamp,pageFooterForm:j_id2456'>
      debug[9:16:34,756]: search for elements by name 'script' in element #document
      debug[9:16:34,764]: getElementsByTagName found 3
      debug[9:16:34,765]: <script> in response with src=/PermitManagerWeb/a4j_3_2_0-SNAPSHOT/org/ajax4jsf/framework.pack.js.jsf
      debug[9:16:34,766]: Such element exist in document
      debug[9:16:34,766]: <script> in response with src=/PermitManagerWeb/a4j_3_2_0-SNAPSHOT/org/richfaces/ui.pack.js.jsf
      debug[9:16:34,767]: Such element exist in document
      debug[9:16:34,768]: search for elements by name 'link' in element #document
      debug[9:16:34,776]: getElementsByTagName found 1
      debug[9:16:34,778]: <link> in response with src=/PermitManagerWeb/a4j_3_2_0-SNAPSHOTorg/richfaces/skin-ext-classes.xcss/DATB/eAETWfO1GAAEtQIp.jsf
      debug[9:16:34,779]: Such element exist in document
      debug[9:16:34,779]: Update page part from call parameter for ID dashboardForm:dashboard
      debug[9:16:34,780]: call getElementById for id= dashboardForm:dashboard
      debug[9:16:34,796]: Replace content of node by replaceChild()
      debug[9:16:34,803]: search for elements by name 'script' in element table
      debug[9:16:34,811]: getElementsByTagName found 0
      debug[9:16:34,812]: Scripts in updated part count : 0
      debug[9:16:34,813]: Update part of page for Id: dashboardForm:dashboard successful
      debug[9:16:34,814]: Update page part from call parameter for ID dashboardForm:updateStamp
      debug[9:16:34,814]: call getElementById for id= dashboardForm:updateStamp
      debug[9:16:34,816]: Replace content of node by replaceChild()
      debug[9:16:34,817]: search for elements by name 'script' in element span
      debug[9:16:34,824]: getElementsByTagName found 0
      debug[9:16:34,825]: Scripts in updated part count : 0
      debug[9:16:34,826]: call getElementById for id= org.ajax4jsf.oncomplete
      debug[9:16:34,827]: Update part of page for Id: dashboardForm:updateStamp successful
      debug[9:16:34,828]: call getElementById for id= ajax-view-state
      debug[9:16:34,828]: Hidden JSF state fields: [object HTMLSpanElement]
      debug[9:16:34,829]: Namespace for hidden view-state input fields is undefined
      debug[9:16:34,830]: search for elements by name 'input' in element span
      debug[9:16:34,835]: getElementsByTagName found 1
      debug[9:16:34,837]: Replace value for inputs: 31 by new values: 1
      debug[9:16:34,837]: Input in response: javax.faces.ViewState
      debug[9:16:34,838]: Found same input on page with type: hidden
      debug[9:16:34,839]: Found same input on page with type: hidden
      debug[9:16:34,840]: Found same input on page with type: hidden
      debug[9:16:34,841]: Found same input on page with type: hidden
      debug[9:16:34,842]: Found same input on page with type: hidden
      debug[9:16:34,844]: Found same input on page with type: hidden
      debug[9:16:34,845]: Found same input on page with type: hidden
      debug[9:16:34,846]: search for elements by name 'INPUT' in element span
      debug[9:16:34,851]: getElementsByTagName found 0
      debug[9:16:34,852]: Replace value for inputs: 31 by new values: 0
      debug[9:16:34,853]: call getElementById for id= _A4J.AJAX.focus
      debug[9:16:34,854]: No focus information in response
      


      Anyone have an idea as to what the problem might be?

      Thanks!
      Chris

        • 1. Re: a4j:poll only fires onces with RF 3.2.0 (limitToList bug
          cdollar393

          More info...

          Removing the attribute

          limitToList="true"

          gets it working and firing repeatedly. This seems like a bug to me? mabye I should open a jira issue?

          Also, I'm not able to get a4j:push to work with 3.2.0. Events are fired like normal, but it appears that the push doesn't get them as nothing is ever reRendered. To test it further I added an
          oncomplete="alert('foo');"

          to the a4j:push tag, and I never see it either.

          Has anyone else encountered this?

          Chris

          • 2. Re: a4j:poll only fires onces with RF 3.2.0
            cdollar393

            So I'm pretty sure the reason a4j:push isn't working for me is related to this bug http://jira.jboss.com/jira/browse/RF-2960 since I too am using facelets.

            Is anyone else seeing the problem with limitToList in an a4j:poll ?? I'm happy to open a jira issue for this, but I would like to know if anyone else is seeing the same behavior before doing so.

            Chris

            • 3. Re: a4j:poll only fires onces with RF 3.2.0

              a4j:poll is designed to update itself in order to be sensitive for attributes (such enable, oncomplete) changes.
              As soon as you limit update to the list, but not include the a4j:poll to this list, it is fired just once.

              So, it works like designed. Just add "poll" to the reRender.

              • 4. Re: a4j:poll only fires onces with RF 3.2.0
                brambilla

                I tried to use a4j:poll to periodically refresh some datatable.
                It works correctly until I go to another page of the application and return to the screen with a4j:poll, the following error occurs js:

                 

                Message: Object required
                Linha: 2797
                Caractere: 1
                Código: 0
                URI: http://localhost:8080/SysTest/a4j/g/3_3_3.Final/org/ajax4jsf/framework.pack.js.jsf

                 

                Someone has been there, have any solutions?

                Thanks.


                My code:

                <a4j:region>
                  <h:form>
                    <a4j:poll id="poll" interval="5000" timeout="50000" action="#{myMB.findConfig}" reRender="poll,gridS"/>  
                  </h:form>
                </a4j:region>

                 
                <h:form>
                   <rich:dataGrid value="#{myMB.listConfig}" id="gridS"  var="sen" columns="3" elements="9" width="100%">
                      <rich:panel bodyClass="pbody">
                         <f:facet name="header">
                         <h:outputText value="#{sen.pcd.ds_nome_pcd}"></h:outputText>
                      </f:facet>

                       <h:panelGrid columns="2">

                                    <h:outputText value="#{i18n.label_sensor}:" styleClass="label"></h:outputText>
                                    <h:outputText value="#{sen.sensorCfg.ds_id_fisico}" />

                       </h:panelGrid>

                      </rich:panel>

                      <f:facet name="footer">
                          <rich:datascroller></rich:datascroller>
                      </f:facet>
                    </rich:dataGrid>

                </h:form>

                • 5. Re: a4j:poll only fires onces with RF 3.2.0
                  ilya_shaikovsky

                  I tried to open http://livedemo.exadel.com/richfaces-demo/richfaces/poll.jsf then navigated to other component and returned back. All works fine for me. Maybe you trying to use navigation via Ajax? If so make sure it's redirect. If not helps try to replace navigation control with h:command.