Value of h: selectOneMenu is not being defined

0

I have already created forms in JSF several times, but I do not understand why% of% of this value is not being set.

        <h:form>
                    <h:selectOneMenu id="nova-matriz-select"
                                 value="#{historicoMatrizMatriculaBean.novaMatrizCurricular}"
                                 required="true"
                                 styleClass="uniformselect">
                        <f:selectItem itemLabel="-- Selecione --" noSelectionOption="true" />
                        <f:selectItems value="#{historicoMatrizMatriculaBean.matrizesCurriculares}"
                                       var="mc" itemValue="#{mc}" itemLabel="#{mc.opcaoCurricular.complementoSigla} - #{mc.nome}" />
                    </h:selectOneMenu>

                <h:commandButton id="salvar-btn"
                                 action="list.xhtml?faces-redirect=true"
                                 actionListener="#{historicoMatrizMatriculaBean.salvarAlteracao()}"
                                 value="Salvar"
                                 styleClass="stdbtn btn_orange submitbtn" />
        </h:form>

Can anyone see the problem here?

NOTE: The getters / setters of the selectOneMenu attribute have been created.

EDITED

@Named
@ConversationScoped
public class HistoricoMatrizMatriculaBean {

    private MatrizCurricular novaMatrizCurricular;
    private List<MatrizCurricular> matrizesCurriculares;

    public void init() {
        this.matrizesCurriculares = service.obterMatrizes();
    }

    public List<MatrizCurricular> getMatrizesCurriculares() {
        return matrizesCurriculares;
    }

    public void setMatrizesCurriculares(List<MatrizCurricular> matrizesCurriculares) {
        this.matrizesCurriculares = matrizesCurriculares;
    }

    public MatrizCurricular getNovaMatrizCurricular() {
        return novaMatrizCurricular;
    }

    public void setNovaMatrizCurricular(MatrizCurricular novaMatrizCurricular) {
        this.novaMatrizCurricular = novaMatrizCurricular;
    }
}
    
asked by anonymous 07.07.2017 / 20:22

1 answer

0

I'm not entirely sure about the cause of the problem, but I suspect it's because of the implementation of the hasCode() method or the toString() method of the MatrizCurricular class. Both methods have very different implementations of other classes of the same project.

As a change to these methods can cause unintended impacts, I used an OmniFaces project converter: SelectItemsIndexConverter link

    
14.07.2017 / 21:11