Value of h:selectOneMenu is not being set

Asked

Viewed 48 times

0

I’ve created JSF forms several times, but I’m not understanding why value that selectOneMenu not being defined ("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: Attribute getters/setters novaMatrizCurricular were 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;
    }
}
  • Post Managedbean code to help analysis

  • I added what I found more pertinent from Managedbean @Marquezani...

1 answer

0


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

As a change in these methods may cause unforeseen impacts, I used an Omnifaces project converter: SelectItemsIndexConverterhttp://showcase.omnifaces.org/converters/SelectItemsIndexConverter

Browser other questions tagged

You are not signed in. Login or sign up in order to post.