繁体   English   中英

JSF与trinidad tr:selectOneChoice

[英]JSF with trinidad tr:selectOneChoice

假设我正在使用此组件如下:

<tr:selectOneChoice label="Sports" required="#{true}" showRequired="#{true}">
 <f:selectItem itemLabel="Swimming" itemValue="1" />
 <f:selectItem itemLabel="Football" itemValue="2" />
 <f:selectItem itemLabel="Soccer" itemValue="3" />
 <f:selectItem itemLabel="Running" itemValue="4" />
  <f:selectItem itemLabel="Sailing" itemValue="5" />
    <f:facet name="help">
     <tr:outputText value="Please select" />
   </f:facet>     
</tr:selectOneChoice>

在从服务器触发某些事件后,是否可以将新项目动态添加到列表中?

我的意思是让我们说用户选择了一些项目,然后,在提交事件之前,从服务器开火,应该将所选项目更改为其他项目。

谢谢!

是。 这是可能的,但你必须定义一个映射在支持bean中的列表,如:

<tr:selectOneChoice label="Sports" required="#{true}" showRequired="#{true}">   
    <f:selectItems value="#{backingBean.values}" />    
</tr:selectOneChoice>

注意这里的区别f:selectItems正在使用f:selectItems而不是f:selectItem

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM