gpt4 book ai didi

java - JSF Trinidad selectOneChoice UI 组件

转载 作者:行者123 更新时间:2023-12-01 05:04:10 30 4
gpt4 key购买 nike

这是我的 .xhtml 文件

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

我希望能够识别客户端的不同选项。在我的支持 bean 中,每个选择都有 boolean 值。

是否可以在客户端实际识别这些选项?

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 类包含我希望能够在客户端看到的标志。

有人知道怎么做吗?

谢谢,

约翰。

最佳答案

为什么不直接创建 MyObjList,迭代该列表并使用 f 上的 itemDisabled 属性: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>

关于java - JSF Trinidad selectOneChoice UI 组件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12957789/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com