<h:selectManyListbox id="sectorsListBox" size="2" multiple="multiple" value="#{Mybean.classificationSelectedItems}">
<f:selectItems id="sectors" value="#{Mybean.classificationSelectItems}"/>
</h:selectManyListbox>
支持 Bean 具有:
public class Mybean
{
private Map<String,String> classificationSelectItems = new LinkedHashMap<String,String>();
private List<String> classificationSelectedItems = new ArrayList<String>();
//getter and setter for both.
}
init()
{
classificationSelectItems.put("INS","Insurance")
classificationSelectItems.put("HLC","HealthCare")
}
选择多个框使用这两个值进行初始化,但问题是只有最后一个选择的条目存储在分类选择项中。为什么呢 ?以及如何获取存储在 classificationSelectedItems 列表中的所有选定条目?
添加仅供参考,init 方法是 Spring 的类。