0
我有一個ice:selectOneMenu
組件並需要獲得從頁面中選擇的ID和值:獲取標籤的ID和值在冰
<ice:selectOneMenu partialSubmit="true"
value="#{bean.selectedType}" valueChangeListener="#{bean.listenerSelectedType}">
<f:selectItems value="#{bean.typeValues}"/>
<ice:selectOneMenu/>
public List<?> getTypeValues(){
List<SelectItem> returnList = new ArrayList<SelectItem>();
...
//SelectItem item = new SelectItem(id, label);
SelectItem item = new SelectItem("A", "B");
returnList.add(item);
}
public void listenerSelectedType(ValueChangeEvent event) {
...
//The event only has the id ("A")
//How can I get the label ("B") that is in the page?
}
感謝您的回覆。這是我實施的解決方案。我認爲還有另一種方法可以在不迭代的情況下獲得標籤值。 – user2095246 2013-02-22 11:27:36
不客氣。您所說的解決方案基於使用「Map」實例來保存數據。 – skuntsel 2013-02-22 11:42:56
此外,您可以選擇答案作爲接受,如果它幫助你解決你的問題。 – skuntsel 2013-02-22 11:43:40