title: Execute actionListener before ajax?
body: <p>How can I execute an actionListener before a ajax request?</p>
  
  <pre><code>&lt;h:commandButton actionListener=.. action=..&gt;
  &lt;f:ajax render="test"&gt;
  &lt;/h:commandButton&gt;
  </code></pre>
  
  <p>order of execution is:</p>
  
  <pre><code>test
  actionListener
  action
  </code></pre>
  
  <p>What can I change so that actionListener method is executed before f:ajax?</p>
  
  <hr>
  
  <p>Full example:</p>
  
  <pre><code>&lt;h:form&gt;
      &lt;h:commandButton value="test" actionListener="#{bean.toggleProgress}" action="#{bean.do()}" &gt; 
          &lt;f:ajax execute="@form" render="progress" /&gt;
      &lt;/h:commandButton&gt;
  
      &lt;h:panelGroup id="progress" &gt;
          &lt;h:outputText rendered="#{bean.progress}" /&gt;
      &lt;/h:panelGroup&gt; 
  &lt;/h:form&gt;
  
  class Bean {
  
      private progress = false;
  
      public boolean isProgress() {
          System.out.println("in: ajax")
          return progress;
      }
  
      public toggleProgress(ActionEvent e) {
          System.out.println("in: actionListener")
          progress = true;
      }
  
      public void do() {
          System.out.println("in: action")
      }
  }
  </code></pre>
  
  <p>systout is:</p>
  
  <pre><code>in: ajax
  in: actionListener
  in: action
  </code></pre>