Object is not filled

0

I have the following form from my page:

<h:panelGrid columns="3">
                            <p:outputLabel value="Código" for="codigo"/>
                            <p:inputText id="codigo" value="#{encomendaController.encomenda.codigo}" required="true"/>
                            <p:message for="codigo"/>
                            <p:outputLabel value="Loja/Origem" for="loja"/>
                            <p:selectOneMenu id="loja" value="#{encomendaController.encomenda.loja}" required="true">
                                <f:selectItem itemLabel="" itemValue="" />
                                <f:selectItems value="#{enumHelper.obterLojas()}" var="bean" itemLabel="#{bean.nome}" itemValue="#{bean.nome}" />
                            </p:selectOneMenu>
                            <p:message for="loja"/>
                            <p:commandButton value="Cadastrar" action="#{encomendaController.salvar()}" process="@this"/>
                        </h:panelGrid>

This is my controller:

@ManagedBean
@ViewScoped
public class EncomendaController {

    @Getter
    @Setter
    private Encomenda encomenda;

    @Getter
    @Setter
    private Collection<Encomenda> objetos;

    @Inject
    private EncomendaService service;

    @PostConstruct
    public void novo() {
        encomenda = new Encomenda();
    }

    public void salvar() {
        if (encomenda.getId() == null) {
            service.insert(encomenda);
            JsfUtils.addInfoMessage("encomenda.cadastrada");
        } else {
            service.update(encomenda);
        }
    }

What is happening is that clicking on the Register button, the values are not going to the object, that is, the attributes are not being filled. How can I resolve?

    
asked by anonymous 20.03.2017 / 17:16

1 answer

0

Try replacing the process="@this" of your button with @form .

    
29.03.2017 / 07:11