0

I build application with primefaces and use a commandbutton to call a rest service, in the method also redirect another page, in this page have a button with actionListener, but this doesn't execute the action.

The button in jsf after redirect (makeDevengo.jsf):

<p:commandButton value="View Devengo"
                            actionListener="#{devengosBean.showDevengo}">
                        </p:commandButton>

The initial button call (devengo.jsf):

<p:commandButton value="Make Devengo"
                    actionListener="#{devengosBean.newDevengo}">
                </p:commandButton>

The first method :

public void newDevengo(ActionEvent event) {



    try {

        // Rest call 
        //Redirection

        ExternalContext ec = context.getExternalContext();
        ec.redirect("/myPath/makeDevengo.jsf");
        return;



    } catch (Exception e) {
        context.addMessage(null, new FacesMessage(
                FacesMessage.SEVERITY_ERROR, "Error",
                "Make devengo problem));
        LOGGER.error(e);
    }

}

The method never call:

    public void showDevengo(ActionEvent event) {

    System.out.println("--->showDevengo");
}
Kukeltje
  • 12,223
  • 4
  • 24
  • 47

1 Answers1

0

Be sure commandButton doesnt fire the method when you put breakpoint. Be sure the second commandbutton is in a form. Try addding update clause. If still doesnt work, share your whole codes.

simyaci
  • 53
  • 6