1

これは私の .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 クラスには、クライアント側で表示できるようにするフラグが含まれています。

誰もそれを行う方法を知っていますか?

ありがとう 、

ジョン。

4

1 に答える 1

0

Listのを作成し、MyObjリストを繰り返し処理して、のitemDisabled属性を使用してみませんかf:selectItem

<tr:selectOneChoice>
  <tr:forEach items="#{bean.myObjList}" var="myObj">
    <f:selectItem itemLabel="#{myObj.label}"
                  itemValue="#{myObj.value}"
                  itemDisabled="#{myObj.flag}"/>
  </tr:forEach>
</tr:selectOneChoice>
于 2012-10-19T08:44:34.750 に答える