2 Replies Latest reply on Oct 26, 2007 5:26 AM by Julien Martin

    Please provide a working example for a4j:push

    Julien Martin Expert

      Hello,
      I use richfaces in my company and I am interested in the a4j:push component. I would like to reproduce the same example as with the a4j:poll but with an a4j:push and would be very grateful if someone could post a working example for someone like me who doesn't know event programming.

      Here is what I have got:

      public TheBean() {
       }
      
       private Date date;
      
       private PushEventListener listener;
      
       public void addListener(EventListener listener) {
       synchronized (listener) {
       if (this.listener != listener) {
       this.listener = (PushEventListener) listener;
       }
       }
       }
      
       public Date getDate() {
       return new Date();
       }
      
      
      }
      


      
       <a4j:push reRender="msg" eventProducer="#{theBean.addListener}" interval="3000"/>
       <h:outputText id="msg" value="#{theBean.date}">
       <f:convertDateTime type="time"/>
       </h:outputText>
      


      Can someone please tell me how to turn all this into a working example...

      Thanks in advance,

      Julien.