title: Session scoped managed bean and actionListener
body: <p>I want to do multiple actions on different managed beans with the same button, one being scoped session and the other request. In my example I use the same bean for both.</p>
  
  <p>index.xhtml</p>
  
  <pre><code>    &lt;h:form&gt;
          &lt;p:commandButton image="ui-icon ui-icon-notice" action="#{controller.inc()}" update="result"&gt;
              &lt;f:actionListener type="controller.Controller" /&gt;
          &lt;/p:commandButton&gt;
      &lt;/h:form&gt;
  
      &lt;p:panel id="result"&gt;
          #{controller.count}
      &lt;/p:panel&gt;
  </code></pre>
  
  <p>controller.Controller.java</p>
  
  <pre><code>@Named(value = "controller")
  @SessionScoped
  public class Controller implements ActionListener, Serializable
  {
      int count = 0;
  
      public Controller(){
          System.out.println("new");
      }
  
      public void inc(){
          count += 1;
      }
  
      public int getCount(){
          return count;
      }
  
      @Override
      public void processAction(ActionEvent event) throws AbortProcessingException{
          count += 1000;
      }
  }
  </code></pre>
  
  <p>When I press the button the count increases by 1, instead of 1001, and creates a new bean. What did I do wrong ?</p>
  
  <p>Thanks.</p>