JSF - selectManyListbox附带已选择的项目

时间:2011-08-26 09:00:13

标签: java jsf jsf-2

我有一个简单的问题,我希望解决方案也很简单......

我的selectManyListbox中的所有项目都已默认选中,我不希望这样。

我到处寻找可能的选择,但我一无所获。

有人可以帮助我吗?

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

提前谢谢你 弗朗西斯科

2 个答案:

答案 0 :(得分:1)

selectItemsvalue属性的列表相同。使用selectedObjects属性中的其他列表(例如value)来保留选择,例如:

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

答案 1 :(得分:0)

添加包含文字Please Select的默认项并以编程方式对其进行处理

相关问题