簡體   English   中英

JSF特立尼達selectOneChoice UI組件

[英]JSF Trinidad selectOneChoice UI COmponent

這是我的.xhtml文件

<tr:selectOneChoice >
   <f:selectItems value="#{bean.items}"/>
</tr:selectOneChoice>

我希望能夠在客戶端的不同選項之間進行標識。 在我的后備豆中,每個選擇都有布爾值。

是否可以在客戶端中在這些選項之間進行實際標識?

Bean代碼如下所示:

public List<SelectItem> getItems(Menu menu) {
    List<SelectItem> list = new ArrayList();
    SelectItem selectItem = new SelectItem(new MyObj("some string",false), "label");
    list.add(selectItem);
    return list;
}

MyObj類包含我希望能夠在客戶端看到的標志。

有人知道該怎么做嗎?

謝謝 ,

約翰。

為什么不創建MyObj List ,遍歷該列表並在f:selectItem上使用itemDisabled屬性。

<tr:selectOneChoice>
  <tr:forEach items="#{bean.myObjList}" var="myObj">
    <f:selectItem itemLabel="#{myObj.label}"
                  itemValue="#{myObj.value}"
                  itemDisabled="#{myObj.flag}"/>
  </tr:forEach>
</tr:selectOneChoice>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM