How to keep a checkbox true after an error message is displayed?

1

How can I keep a true checkbox when I display an error message? Every time I display a errorMessage my checkBox turns false . How can I solve this problem? I'm using jsf2.0 and primefaces .

This is the button that calls a method:

    <p:commandButton styleClass="btIcon" 
                                 value="Consolidar"
                                 image="addIcon"
                                 process="@this :formCadastro"
                                 actionListener="#{bean.addConsolidacao}"
                                 onclick="carregando.show();"
                                 oncomplete="carregando.hide();" 
                                 rendered="true" 
                                 update="@this :formCadastro :formPanel" />
    
asked by anonymous 18.03.2014 / 19:30

1 answer

1

I noticed the problem, when the page is rerendered the checkbox is not part of the entity. The solution is to just set a transient in the entity in order to manipulate it.

    @Transient
private Boolean acaoCheck;

public Boolean getAcaoCheck() {
    return acaoCheck;
}

public void setAcaoCheck(Boolean acaoCheck) {
    this.acaoCheck = acaoCheck;
}
    
21.03.2014 / 15:34