title: jsf primefaces progressbar update value while action method is running
body: <p>I have a submit-button on the bottom of my JSF-page, which submits all the inputs (texts, files etc.) to the database and server. Due to the duration this action takes, I want to show the user the progress of the operation, and on finish redirect him on the finish-site.</p>
  
  <p>My bean looks like:</p>
  
  <pre><code>&lt;h:form enctype="multipart/form-data"&gt;
      &lt;p:commandButton widgetVar="submitButton" value="Save to DB" action="#{bean.submit}" onclick="PF('submitButton').disable();" /&gt;
      &lt;p:progressBar widgetVar="pbAjax" ajax="true" value="#{bean.saveProgress}" interval="1000" labelTemplate="{value}%" styleClass="animated" /&gt;            
  &lt;/h:form&gt;
  </code></pre>
  
  <p>and my code:</p>
  
  <pre><code>private int saveProgress;
  
  public String submit(){
      for(int i = 0; i &lt; 100; i++){ //dummy values
          //DB operations
          //file uploads
          saveProgress = i;
          System.out.println("Progress: " + saveProgress);
      }
  
      return "finished.xhtml";
  }
  
  //getter for saveProgress
  </code></pre>
  
  <p><strong>the problem is, that neither the progressbar updates nor the pages navigates to finished.xhtml when done.</strong></p>
  
  <p>What am I doing wrong here? is this a thread-problem (because submit is not thread-safe?)
  How can I solve this problem?</p>