title: PrimeFaces actionListener not calling bean
body: <p>I am trying to mimic the <a href="https://www.primefaces.org/showcase/ui/df/basic.xhtml" rel="nofollow noreferrer">PrimeFaces Dialog example</a>. For some reason that I am not able to find, my PrimeFaces button does not seem to call the required managed bean method:</p>
  
  <pre><code>            &lt;h:form&gt;
                  &lt;p:commandButton value="Open" icon="ui-icon-extlink" actionListener="#{myController.createDialog()}" /&gt;
              &lt;/h:form&gt;
  </code></pre>
  
  <p>Managed bean:</p>
  
  <pre><code>@Named(value = "myController")
  @ViewScoped
  public class MyController implements Serializable {
  
      public void createDialog() {
          System.out.println("%%%%%%%%%%%%%%%%%%%%%%%%%");
  ...
  </code></pre>
  
  <p>The print statement is never executed, like if the Listener was not working. When I click the button, no response is given. No backend error, no JS error, nothing. I only see that <em>some</em> request is done because I log when a user passes the authorization layer. So something happens but seems to fail silently.</p>
  
  <p>What I have tried:</p>
  
  <ul>
  <li>Move the button to other places in the page</li>
  <li><p>Use an id:</p>
  
  <pre><code>&lt;p:commandButton id="ex" value="Open" icon="ui-icon-extlink" actionListener="#{myController.createDialog()}" /&gt;
  &lt;h:message for="ex" /&gt;
  </code></pre></li>
  <li><p>Remove the <code>ViewScoped</code></p></li>
  <li><p>Require a <code>javax.faces.event.ActionEvent</code> in the method</p>
  
  <pre><code>public void createDialog(ActionEvent event) {
      System.out.println("%%%%%%%%%%%%%%%%%%%%%%%%%");
  </code></pre></li>
  <li><p>Change the method signature</p>
  
  <pre><code>action="#{myController.createDialog(5)}"
  </code></pre>
  
  <p>and</p>
  
  <pre><code>public void createDialog(int s) {
      System.out.println("%%%%%%%%%%%%%%%%%%%%%%%%%");
  </code></pre></li>
  <li><p>I even tried to create a <code>WEB-INF/faces-config.xml</code> (which I would prefer not to, and according to <a href="https://www.primefaces.org/docs/guide/primefaces_user_guide_6_2.pdf" rel="nofollow noreferrer">PrimeFaces documentation</a> I do not need it) with:</p>
  
  <pre><code>  &lt;?xml version='1.0' encoding='UTF-8'?&gt;
     &lt;faces-config version="2.2"
            xmlns="http://xmlns.jcp.org/xml/ns/javaee"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee 
  
            http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd"&gt;
  &lt;application&gt;
      &lt;action-listener&gt;org.primefaces.application.DialogActionListener&lt;/action-listener&gt;
      &lt;navigation-handler&gt;org.primefaces.application.DialogNavigationHandler&lt;/navigation-handler&gt;
      &lt;view-handler&gt;org.primefaces.application.DialogViewHandler&lt;/view-handler&gt;
  &lt;/application&gt;
  
  &lt;lifecycle&gt;
      &lt;phase-listener&gt;org.primefaces.component.lifecycle.LifecyclePhaseListener&lt;/phase-listener&gt;
  &lt;/lifecycle&gt;
  </code></pre>
  
  <p></p></li>
  </ul>
  
  <p>Other answers I have checked are: <a href="https://stackoverflow.com/questions/2118656/commandbutton-commandlink-ajax-action-listener-method-not-invoked-or-input-value">1</a>, <a href="https://stackoverflow.com/questions/42076473/actionlistener-method-not-called-from-dialog-commandbutton">2</a>, <a href="https://stackoverflow.com/questions/42076473/actionlistener-method-not-called-from-dialog-commandbutton">3</a>, <a href="https://stackoverflow.com/questions/24681414/primefaces-commandbutton-actionlistener-not-firing">4</a>, <a href="https://stackoverflow.com/questions/10848294/primefaces-commandbutton-actionlistener-not-called">5</a>, <a href="https://forum.primefaces.org/viewtopic.php?t=8311" rel="nofollow noreferrer">6</a></p>
  
  <hr>
  
  <p>Apparently the use of <code>actionListener</code>s in PrimeFaces <a href="https://stackoverflow.com/questions/3909267/differences-between-action-and-actionlistener/3909382#3909382">is not as correct as it should be</a>... Is there another way to use PrimeFaces components?</p>