Primefaces (TabView): Null properties when saving


I'm using a TabView with two tabs and each tab with an external file with fields. By clicking the "Save" button the attributes are coming as null. Here is the code:

Registered Clients.xhtml:

<h:form id="frm-cadastro-cliente-dialog">
    <p:dialog header="Cadastrar Cliente" widgetVar="cadastroClienteDialog">
            <p:tab title="Dados Pessoais">
                <h:panelGrid columns="2">
                    <ui:include src="/WEB-INF/cliente/ClientePartialDadosPessoais.xhtml" />

            <p:tab title="Endereço">
                <h:panelGrid columns="2">
                    <ui:include src="/WEB-INF/cliente/ClientePartialEndereco.xhtml" />

        <p:commandButton value="Salvar" action="#{clienteBean.salvar}"/>


<p:outputLabel value="Nome" for="nome" />
<p:inputText id="nome" required="true" value="#{clienteBean.cliente.nome}" />

<p:outputLabel value="E-mail" for="email" />
<p:inputText id="email" value="#{}" />

<!--  outros campos... -->


<p:outputLabel value="Logradouro" for="logradouro" />
<p:inputText id="logradouro" value="#{clienteBean.cliente.logradouro}" />

<p:outputLabel value="Complemento" for="complemento" />
<p:inputText id="complemento" value="#{clienteBean.cliente.complemento}" />

<!--  Outros campos... -->

public class ClienteBean {

    private Cliente cliente;

    public void salvar() {
        System.out.println("Nome: " + cliente.getNome()); //null
        System.out.println("E-mail: " + cliente.getEmail()); //null
        System.out.println("Logradouro: " + cliente.getLogradouro()); //null
        System.out.println("Complemento: " + cliente.getComplemento()); //null

Note: I am using CDI.

asked by anonymous 27.02.2017 / 20:13

1 answer


I believe you have not processed the form. Try not to process the form Ex

<p:commandButton value="Salvar" action="#{clienteBean.salvar}" process="@form"/>

It may also be scope problem, try switching to @ViewScoped from javax.faces.view.ViewScoped instead of @RequestScoped. And keep the process="@ form"

01.03.2017 / 14:11