Commandbutton Primefaces does not call the method

Asked

Viewed 654 times

1

Man commandbutton does not show error when clicked, but also does not execute the method.

Commandbutton code:

p:commandButton action="#{clienteMB.cliente.Salvar}" value="Incluir"/

Method code:

public void Salvar(){
        System.out.println("Funcionou...);
}

Using apache Tomcat worked well, but glassfish has no results and no errors. Someone can help me?

1 answer

2


When to use action or actionListener:

action is used when you will perform action/nagevação. Your method needs to return a String with the next destination or return null to stay on the same screen.

actionListener is used to change components or state of an object, for example, to execute a method and then update a table.

Try it this way:

<p:commandButton actionListener="#{clienteMB.cliente.Salvar}" process="@this" value="Incluir"/>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.