Call page xhtml by commandButton

0

I'm implementing the toolbar component of primefaces and inside this component there are several commandButtons that I need when clicking it call another xhtml page of my project. How to do? ex:

<p:commandButton type="button" value="Cadastro de Cliente"
                icon="ui-icon-plus"  action="CadastroClientePrime.xhtml" />
    
asked by anonymous 16.05.2016 / 12:54

1 answer

2

There are some modes of navigation such as dynamically, static and redirected.

For static navigation, see a simple example:

<p:commandButton value="Sobre" action="sobre" />

remembering that for my page I gave the name "sobre.xhtml".

Now, see an example of dynamic navigation, so you need a method

 <p:commandButton value="Sobre" action="#{ControlePrincipal.sobre()}" />

Method:

  public String sobre()
  {
    return "sobre";
  }
    
17.05.2016 / 19:21