简体   繁体   English

JSF与trinidad tr:selectOneChoice

[英]JSF with trinidad tr:selectOneChoice

Assume that I'm using this component as following: 假设我正在使用此组件如下:

<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>

Is it possible to add dynamically new item to the list after some event trigger from the server? 在从服务器触发某些事件后,是否可以将新项目动态添加到列表中?

I'm mean let's say the user has select some item and then, before submit an event was fire from the server which should change the selected item to some other item. 我的意思是让我们说用户选择了一些项目,然后,在提交事件之前,从服务器开火,应该将所选项目更改为其他项目。

Thanks! 谢谢!

Yes. 是。 this is possible but you have to define a list which is mapped in backing bean like: 这是可能的,但你必须定义一个映射在支持bean中的列表,如:

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

Notice the difference here f:selectItems is being used instead of f:selectItem 注意这里的区别f:selectItems正在使用f:selectItems而不是f:selectItem

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

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