简体   繁体   English

JSF特立尼达selectOneChoice UI组件

[英]JSF Trinidad selectOneChoice UI COmponent

This is my .xhtml file 这是我的.xhtml文件

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

I want to be able to identify between the different options in the client side. 我希望能够在客户端的不同选项之间进行标识。 In my backing bean I have boolean for each Choice. 在我的后备豆中,每个选择都有布尔值。

Is it possible to actually identify between this options in the client side ? 是否可以在客户端中在这些选项之间进行实际标识?

The bean code goes like this : 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 class contains the flag that I want to be able to see in the client side. MyObj类包含我希望能够在客户端看到的标志。

any one know how to do that ? 有人知道该怎么做吗?

thanks , 谢谢 ,

John. 约翰。

Why don't you just create a List of MyObj , iterate through the list and use the itemDisabled attribute on f:selectItem . 为什么不创建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