title: JSF PrimeFaces Progress Bar issues
body: <p>I'm having trouble getting what should be a simple PrimeFaces 4.0 progress bar to work:</p>
  
  <p>What I'm ultimately trying to do is make a button on my UI that when i click it will start a long running background task, that will have its status, shown via a progress bar.  To simulate this case I put together what I thought was a simple example (unfortunately it doesn't seem to be working).</p>
  
  <p>I used a <code>ViewScoped</code> bean as I figured that shouldn't add any scoping issues to the mix.  From using firebug it looks like when I click my <strong>Start Function</strong> button the progress bar starts to make ajax requests, however, the <strong>actionListener</strong> which is tied to the button doesn't seem to run and thus my progress is never updated.  </p>
  
  <p>Any suggestions?</p>
  
  <p><strong>XHTML</strong></p>
  
  <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:ui="http://java.sun.com/jsf/facelets"
        xmlns:p="http://primefaces.org/ui"&gt;
  
      &lt;f:view contentType="text/html"&gt;
          &lt;h:head&gt;
              &lt;f:facet name="first"&gt;
                  &lt;meta content='text/html; charset=UTF-8' http-equiv="Content-Type"/&gt;
                  &lt;title&gt;PrimeFaces Progress Bar&lt;/title&gt;
              &lt;/f:facet&gt;
          &lt;/h:head&gt;
          &lt;h:body&gt;
              &lt;h:form&gt;
                  &lt;p:growl id="growl" /&gt;  
                  &lt;h3&gt;Progress Bar Test&lt;/h3&gt;  
  
                  &lt;p:commandButton value="Start Function" type="button" 
                                   onclick="PF('pbAjax').start();PF('startButton2').disable();" 
                                   widgetVar="startButton2" 
                                   actionListener="#{progressBean.startTestFunction}"/&gt;  
  
                  &lt;p:commandButton value="Cancel" 
                                   actionListener="#{progressBean.cancel}" 
                                   oncomplete="pbAjax.cancel();startButton2.enable();" /&gt;  
  
                  &lt;p:progressBar widgetVar="pbAjax" 
                                 ajax="true" 
                                 value="#{progressBean.progress}" 
                                 labelTemplate="{value}%" 
                                 styleClass="animated"&gt;  
  
                      &lt;p:ajax event="complete" 
                              listener="#{progressBean.onComplete}" 
                              update="growl" 
                              oncomplete="startButton2.enable()"/&gt;  
                  &lt;/p:progressBar&gt;  
              &lt;/h:form&gt;  
          &lt;/h:body&gt;
      &lt;/f:view&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>BEAN</strong></p>
  
  <pre><code>import java.io.Serializable;  
  import javax.faces.application.FacesMessage;  
  import javax.faces.bean.ManagedBean;
  import javax.faces.bean.ViewScoped;
  import javax.faces.context.FacesContext;
  
  @ManagedBean
  @ViewScoped // Does the scope matter here?
  public class ProgressBean implements Serializable {  
  
      public ProgressBean() {};
  
      private Integer progress;  
  
      public Integer getProgress() {  
          System.out.println("getProgress: " + progress);
          return progress;  
      }  
  
      public void startTestFunction() {
          System.out.println("Staring Test Function");
  
          for (int i = 0; i &lt; 100; i++) {
              setProgress(i);
              System.out.println("TestFunction - setting progress to: " + i);
              try {
                  Thread.sleep(200);
              } catch (InterruptedException e) {
              }
          }
          setProgress(100);
          System.out.println("Finished Function");
      }
  
      public void setProgress(Integer progress) { 
          System.out.println("SetProgress called: " + progress);
          this.progress = progress;  
      }  
  
      public void onComplete() {  
          FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Progress Completed", "Progress Completed"));  
      }  
  
      public void cancel() {  
          progress = null;  
      }  
  }  
  </code></pre>