<h:selectManyListbox id="sectorsListBox" size="2" multiple="multiple" value="#{Mybean.classificationSelectedItems}">
<f:selectItems id="sectors" value="#{Mybean.classificationSelectItems}"/>
</h:selectManyListbox>
豆有:H:selectManyListBox二傳手沒有設置備份選擇的所有值
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。爲什麼 ?我如何獲得存儲在classificationSelectedItems列表中的所有選定條目?
添加FYI,init方法是Spring的類。
我剛剛測試過的例子,它工作正常(我使用List alter String []):http://www.mkyong.com/jsf2/jsf-2-multiple-select-listbox-example/ – 2013-04-29 01:23:23
如果你選擇保險和醫療保險,都做在您的classificationSelectedItems設置? – Phoenix 2013-04-29 01:46:18
你可以發佈代碼嗎?當然,他們兩個都是 – Phoenix 2013-04-29 01:47:13