-1

Im trying to go to another JSF page and add an object to an ArrayList, with the button below, the scope of the managed bean is in Session, but when i click the button doesnt go to the other page.

I edited the entire code to show only the important parts, so the Button is in a Form, and the @ManagedBean and @SessionScoped anotations of the managed bean are in place.

XHTML

<p:commandButton value="Ingresar" action="#{cliente.formularioGo()}"/>

Ciente JSF Managed Beans

public String formularioGo() {

    entidades.Cliente cliente = new entidades.Cliente(celular, nombre, direccion);       

    listaCliente.add(cliente);//here I store objects in an ArrayList

    return "fomularioVenta";// This should take me to other JSF page called "formularioVenta"
}
Exit
  • 73
  • 8

1 Answers1

0

first, your button should be in a form;

<p:form>
    <p:commandButton value="Ingresar" action="#{cliente.formularioGo()}"/>
</p:form>

and your class should have annotations like;

@ManagedBean(name="cliente")
@SessionScoped
mokarakaya
  • 693
  • 1
  • 11
  • 19