title: Primefaces actionbutton called several times
body: <p>I've been strugling with an issue I can't find the way to solve it and I can't find anything related on the web.</p>
  
  <p>I'm using Netbeans with Primefaces to develop a JSF web app.</p>
  
  <p>Everything works fine except that sometimes the call to the actionlisteners is being done several times.</p>
  
  <p>For example this is my JSF page with primefaces:</p>
  
  <pre><code>&lt;h:body&gt;
     &lt;ui:composition template="home.xhtml"&gt;
  
          &lt;ui:define name="content"&gt;
              &lt;h2&gt;Administración de alertas SMS&lt;/h2&gt;
  
  
                      &lt;p:panel id="display"&gt;
  
                          &lt;p:selectBooleanCheckbox itemLabel="Enviar alertas SMS" value="#{smsConfigBean.alertsEnabled}"/&gt;
  
                          &lt;p&gt;
                          &lt;h:outputText value="Mensaje de Texto: " /&gt;&lt;br /&gt;&lt;br /&gt;
                          &lt;p:inputTextarea rows="5" cols="50" counterTemplate="{0} caracteres restantes." counter="counter" maxlength="160" value="#{smsConfigBean.smsMessage}" id="smsMessage"/&gt;
                          &lt;br /&gt;
                          &lt;h:outputText id="counter" /&gt;
                          &lt;/p&gt;
  
                          &lt;p&gt;   
                          &lt;h:outputText value="Dispositivo de envio SMS: " /&gt;  
                          &lt;p:selectOneRadio id="options" value="#{smsConfigBean.usePhone}"&gt;  
                              &lt;f:selectItem itemLabel="Modem USB"  itemValue="false" /&gt;  
                              &lt;f:selectItem itemLabel="Telefono Android" itemValue="true" /&gt;                                        
                          &lt;/p:selectOneRadio&gt;  
                          &lt;/p&gt;
                          &lt;br /&gt;
                          &lt;p:tabView id="tabView"&gt;  
  
                              &lt;p:tab id="tab1" title="Modem USB"&gt;  
                                  &lt;h:panelGrid id="modemGrid" columns="2" cellpadding="4"&gt;  
                                      &lt;h:outputText value="Puerto: " /&gt;  
                                      &lt;p:inputText id="port" value="#{smsConfigBean.port}"/&gt;  
  
                                      &lt;h:outputText value="Bit Rate (Opcional): " /&gt;  
                                      &lt;p:inputText id="bitRate" value="#{smsConfigBean.bitRate}"/&gt;  
  
                                      &lt;h:outputText value="Nombre de modem (Opcional): " /&gt;  
                                      &lt;p:inputText id="modemName" value="#{smsConfigBean.modemName}"/&gt;
  
                                      &lt;h:outputText value="PIN: " /&gt;  
                                      &lt;p:inputText id="pin" value="#{smsConfigBean.modemPin}"/&gt;
  
                                      &lt;h:outputText value="Centro de Mensajes: " /&gt;  
                                      &lt;p:inputText id="smsc" value="#{smsConfigBean.SMSC}"/&gt;                                  
                                  &lt;/h:panelGrid&gt;
                              &lt;/p:tab&gt;  
  
                              &lt;p:tab id="tab2" title="Telefono Android"&gt;  
  
                                   &lt;h:panelGrid id="phoneGrid" columns="2" cellpadding="4"&gt;  
                                      &lt;h:outputText value="Path ADB:" /&gt;  
                                      &lt;p:inputText id="adbPath" value="#{smsConfigBean.adbPath}"/&gt;  
  
                                      &lt;h:outputText value="Directorio de Configuracion:" /&gt;  
                                      &lt;p:inputText id="configPath" value="#{smsConfigBean.configPath}"/&gt;  
  
                                      &lt;h:outputText value="Modo de conexion " /&gt;  
                                      &lt;p:selectOneRadio id="connectOptions" value="#{smsConfigBean.useWifi}"&gt;  
                                          &lt;f:selectItem itemLabel="USB" itemValue="false"/&gt;  
                                          &lt;f:selectItem itemLabel="WiFi" itemValue="true" /&gt;                                        
                                      &lt;/p:selectOneRadio&gt;  
  
                                      &lt;h:outputText value="Direccion IP (Solo para WiFi): " /&gt;  
                                      &lt;p:inputText id="ipDir" value="#{smsConfigBean.ipDir}"/&gt;  
  
                                  &lt;/h:panelGrid&gt; 
                              &lt;/p:tab&gt;  
  
                          &lt;/p:tabView&gt; 
  
  
                      &lt;/p:panel&gt;
  
                      &lt;br /&gt;
                      &lt;p:commandButton id="saveSmsAlerts" value="Guardar" update="messages" action="#{smsConfigBean.saveChanges}" actionListener="#{smsConfigBean.saveChanges}"/&gt;
  
  
  
          &lt;/ui:define&gt;
  
      &lt;/ui:composition&gt;
  &lt;/h:body&gt;
  </code></pre>
  
  <p></p>
  
  <p>And this is my backend bean:</p>
  
  <blockquote>
    <p>package Beans;</p>
    
    <p>import helpers.Global; import javax.faces.bean.ManagedBean; import
    javax.faces.bean.SessionScoped;</p>
    
    <p>@ManagedBean @SessionScoped public class SmsConfigBean {</p>
  
  <pre><code>private Boolean alertsEnabled;
  private Boolean usePhone;
  private Boolean useWifi;
  
  private String port;
  private int bitRate;
  private String modemName;
  private String modemPin;
  private String SMSC;
  private String adbPath;
  private String configPath;
  private String ipDir;
  
  private String smsMessage;
  
  public SmsConfigBean() {
      alertsEnabled = Global.getAlertsEnabled();      
      port = Global.getPort();
      bitRate = Global.getBitRate();
      modemName = Global.getModemName();
      modemPin = Global.getModemPin();
      SMSC = Global.getSMSC();
      usePhone = Global.getUsePhone();
      adbPath = Global.getAdbPath();
      configPath = Global.getConfigPath();
      useWifi = Global.getUseWifi();
      ipDir = Global.getIpDir();     
      smsMessage = Global.getSmsMessage();
  }
  
  public Boolean getAlertsEnabled() {
      return alertsEnabled;
  }
  
  public void setAlertsEnabled(Boolean alertsEnabled) {
      this.alertsEnabled = alertsEnabled;
  }
  
  public String getPort() {
      return port;
  }
  
  public void setPort(String port) {
      this.port = port;
  }
  
  public int getBitRate() {
      return bitRate;
  }
  
  public void setBitRate(int bitRate) {
      this.bitRate = bitRate;
  }
  
  public String getModemName() {
      return modemName;
  }
  
  public void setModemName(String modemName) {
      this.modemName = modemName;
  }
  
  public String getModemPin() {
      return modemPin;
  }
  
  public void setModemPin(String modemPin) {
      this.modemPin = modemPin;
  }
  
  public String getSMSC() {
      return SMSC;
  }
  
  public void setSMSC(String SMSC) {
      this.SMSC = SMSC;
  }
  
  public Boolean getUsePhone() {
      return usePhone;
  }
  
  public void setUsePhone(Boolean usePhone) {
      this.usePhone = usePhone;
  }
  
  public String getAdbPath() {
      return adbPath;
  }
  
  public void setAdbPath(String adbPath) {
      this.adbPath = adbPath;
  }
  
  public String getConfigPath() {
      return configPath;
  }
  
  public void setConfigPath(String configPath) {
      this.configPath = configPath;
  }
  
  public Boolean getUseWifi() {
      return useWifi;
  }
  
  public void setUseWifi(Boolean useWifi) {
      this.useWifi = useWifi;
  }
  
  public String getIpDir() {
      return ipDir;
  }
  
  public void setIpDir(String ipDir) {
      this.ipDir = ipDir;
  }
  
  public String getSmsMessage() {
      return smsMessage;
  }
  
  public void setSmsMessage(String smsMessage) {
      this.smsMessage = smsMessage;
  }
  
  public void saveChanges(){
      Global.setSmsMessage(smsMessage);
      Global.setIpDir(ipDir);
      Global.setUseWifi(useWifi);
      Global.setConfigPath(configPath);
      Global.setAdbPath(adbPath);
      Global.setUsePhone(usePhone);
      Global.setSMSC(SMSC);
      Global.setModemPin(modemPin);
      Global.setModemName(modemName);
      Global.setBitRate(bitRate);
      Global.setPort(port);
      Global.setAlertsEnabled(alertsEnabled);
      Global.sendInfoResponseMessage("Cambios guardados con exito");
  } 
  </code></pre>
    
    <p>}</p>
  </blockquote>
  
  <p>The problem is that when saving the changes of this form by hitting the commandButton 'saveSmsAlerts' the call is being made twice. Resulting in the growl message to be shown twice too.
  (You won't see the growl component because it was defined in the template)</p>
  
  <p>This happens also in another page that I did for the same app that uploads a file using fileuploader. The file is uploaded 4 times!!</p>
  
  <p>I'm using chrome to test the application and netbeans to develop it.</p>