Search code examples
jsfjsf-2primefacesactionlistener

actionListener doesn't works jsf and primefaces


I have one .xhtml file with primefaces and have one form with one commandButton when try to fire the actionListener doesn't works this is the form:

<h:form id="formCreate">
                <p:dialog header="Crear" widgetVar="usuarioDlgCreate" resizable="false" id="usuDlgCreate"  
                          showEffect="fade" hideEffect="explode" modal="true">  

                    <h:panelGrid id="display" columns="2" cellpadding="4" style="margin:0 auto;">  

                        <h:outputText value="Rol:" />  
                        <p:inputText value="#{usuarioBean.usuarioSeleccionado.rolId}"/>  

                        <h:outputText value="Nombre:" />  
                        <p:inputText value="#{usuarioBean.usuarioSeleccionado.nomUsuario}"/>  


                        <h:outputText value="Email:" />  
                        <p:inputText value="#{usuarioBean.usuarioSeleccionado.email}" size="30"/>  

                        <f:facet name="footer">
                            <p:separator/>
                            <p:commandButton id="btnNewAccept" actionListener="#{usuarioBean.create(actionEvent)}" title="Guardar" value="Guardar"/>  
                            <p:commandButton id="btnNewCancel" oncomplete="usuarioDlgCreate.hide()" icon="ui-icon-new" title="Cancelar" value="Cancelar"/>  
                        </f:facet>
                    </h:panelGrid>  

                </p:dialog>  

            </h:form>

and this is my bean method:

public void create(ActionEvent actionEvent) {
   UsuarioDao usuarioDao = new UsuarioDaoImplements();
   String msg = null;
   if(usuarioDao.create(this.usuarioSeleccionado)) {
       msg = "Información guardada correctamente";
   } else {
       msg = "No ha sido posible almacenar la información";
   }

    FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, null);
    FacesContext.getCurrentInstance().addMessage(null, message);
}

already tried with the button like:

and the method without the parameter ActionEvent:

and like this too(without parenthesis):

but doesn't fire the method, pleas help me.... thanks a lot


Solution

  • Well, I solved this it seems Primefaces 3.5 and Glassfish 4.0 doesn't work very well, so I changed by Primefaces 4.0 and it works.