开发者

JSF - selectManyListbox comes with items already selected

I have a simple problem and I hope that the solution is also so simple...

The items in my selectManyListbox all comes already selected per default and I don't want this.

I searched everywhere for possible options but I found nothing.

Can someone help me, please?

<h:selectManyListbox 
     value="#{detailModel.afterObjec开发者_C百科t.businessObjectAttributeSpecifications}" 
     size="10"> 
    <f:selectItems 
       value="#{detailModel.getSetAsList(detailModel.afterObject.businessObjectAttribut‌​eSpecifications)}"/> 
</h:selectManyListbox>

Thank you in advance Francesco


You have the same list for the selectItems and the value attribute. Use a different list ( such as selectedObjects) in the value attribute to hold the selection, eg:

<h:selectManyListbox 
     value="#{detailModel.afterObject.selectedBusinessObjectAttributeSpecifications}" 
     size="10"> 
    <f:selectItems 
       value="#{detailModel.getSetAsList(detailModel.afterObject.businessObjectAttribut‌​eSpecifications)}"/> 
</h:selectManyListbox>


Add a default item with text Please Select and treat it programatically

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜