4 Replies Latest reply on Dec 21, 2010 6:45 AM by pujar.santosh

    <a4j:push> works only on reloading the browser

    pujar.santosh

      Hello all,

       

                     I am working on JSF components. I have some machanism to update the client by getting notified objects from backing beans as follows:

       

                      code.JPG

       

         I am using Websphere and  Firefox 3.5.7 to launch the application.

       

         The problem I am currently facing is, the <a4j:push> works only once on loading the browser. To get the latest data from "notificationManagedBean.notifications" (as above)  I need to refresh or reload the whole page again and again.

       

      Could somebody please help to resolve the issue?

       

      I have already tried combinations of :

      <a4j:form>

           <a4j:region>

                     <a4j:push/>

           </a4j:region>

      </a4j:form>

       

      Please let me know if I have missed something.

       

      Thank you in advance

      Santosh

        • 1. Re: <a4j:push> works only on reloading the browser
          pujar.santosh

          Once again the code snippet is here:

           

               <h:form id="index-form">

                        <a4j:push id="push"

                            eventProducer="#{notificationManagedBean.addListener}"

                            interval="2000"  enabled="true" data="#{notificationManagedBean.notifications}"

                            oncomplete="notificationHandler.processNotifications(data);"/>

               </h:form>

          • 2. Re: <a4j:push> works only on reloading the browser
            nbelaevski

            Hi Santosh,

             

            Please check if there any error messages in browser log.

            • 3. Re: <a4j:push> works only on reloading the browser
              pujar.santosh

              Hi Nick,

               

              Thank you for replying.

               

              I used firebug to see whether there are any error messages on browser but I didn't get any messages.

               

              My notificationManagedBean is in application scope(faces-config.xml), is it ok..?? I am totally lost.. not getting any ideas

               

              please help me...

              • 4. Re: <a4j:push> works only on reloading the browser
                pujar.santosh

                Hi All,

                 

                Finally, it worked....

                 

                I used <a4j:outputPanel> over <a4j:push> like below:

                 

                <a4j:outputPanel id="push-panel" ajaxRendered="true" style="display:none">

                <h:form>

                     <a4j:push id="push"

                                    eventProducer="#{notificationManagedBean.addListener}"

                                    interval="2000"

                                    data="#{notificationManagedBean.notifications}"

                                    oncomplete="notificationHandler.processNotification(data);" limitToList="true"/>

                  </h:form>

                </a4j:outputPanel>

                 

                I hope, If somebody is facing this issue, it may help...

                 

                Thank you

                Santosh