How to add selected value to ice: selectOneMenu?

I have a problem with a component ice:selectOneMenu

in Icefaces ..

More details: When I populate the SelecItems

arrayList, I set an empty selcetItem at the first index in the arrayList, for example: mainClassificationsSI.add(new SelectItem(""));

and in my page I have the following:

    <ice:selectOneMenu partialSubmit="true" binding="#
        {editOutgoingBean.mainClassificationSelect}" id="mBookClass" value="#
        {editOutgoingBean.outgoing.main_Classification}" valueChangeListener="#      
        {editOutgoingBean.mainClassificationChanged}">

        <f:selectItems value="#{editOutgoingBean.mainClassificationsSI}"/>
    </ice:selectOneMenu>

      

First of all, I'm sure that: editOutgoingBean.outgoing.main_Classification

has a value that is one of the selectItems values ​​in the SelectItems

arrayList, but when the page is rendered, the Select tag selects an empty value, and that didn't select the value main_Classification

I set earlier ...

When I remove the first Empty SelectItem

from the ArrayList, the Select tag will select the value I set for main_Classification

. Please help me know what to do ...

0


a source to share


1 answer


try this may help you.

<ice:selectOneMenu partialSubmit="true" binding="#
    {editOutgoingBean.mainClassificationSelect}" id="mBookClass" value="#
    {editOutgoingBean.outgoing.main_Classification}" valueChangeListener="#      
    {editOutgoingBean.mainClassificationChanged}">
    <f:selectItem itemLabel="Select" itemValue="-1" />
    <f:selectItems value="#{editOutgoingBean.mainClassificationsSI}"/>
</ice:selectOneMenu>`

      



and don't fetch the black element from the bean like you did

+1


a source







All Articles