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.businessObjectAttributeSpecifications)}"/>
</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.businessObjectAttributeSpecifications)}"/>
</h:selectManyListbox>
Add a default item with text Please Select
and treat it programatically
精彩评论