selectitem和selectitems标记之间的区别 [英] Difference between selectitem and selectitems tags
问题描述
jsf中selectitem和selectitems标记之间有什么区别?
不同之处正是您期望的。 selectitem
标记向HTML列表添加单个项目,而 selectitems
添加多个项目。
从 JSF Core Tag Reference : 示例: HTML输出: 示例: HTML输出: What is the difference between the selectitem and selectitems tags in jsf? The difference is exactly what you would expect. The From JSF Core Tag Reference: The Example: HTML Output:
The Example: HTML Output:
这篇关于selectitem和selectitems标记之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
$ b SelectItem:
UISelectItem
组件添加到与封闭标记关联的组件。在HTML renderkit中,这会创建一个单一元素。它可以与JSF HTML标记库中的任何选择标记一起使用。
<$ p $这个标签的主体内容必须是空的。 p> < h:selectOneMenu id =list1>
< f:selectItem itemLabel =Option 1itemValue =1>< / f:selectItem>
< / h:selectOneMenu>
< select id =list1name =list1size =1>
< option value =1>选项1< / option>
< / select>
SelectItems:
SelectItems
标记向与封闭标记关联的组件添加子元素 UISelectItems
组件。您可以使用此标记将域模型中的对象列表设置为选定组件的选项。
<$ p $这个标签的主体内容必须是空的。 p> < h:selectManyListbox id =list>
< select id =listname =listmultiple =truesize = - 2147483648>
< option value =1>选项1< / option>
< option value =2>选项2< / option>
< option value =3>选项3< / option>
< / select>
selectitem
tag adds a single item to the HTML list while selectitems
adds multiple items.SelectItem:
SelectItem
tag adds a child UISelectItem
component to the component associated with the enclosing tag. In the HTML renderkit, this creates a single element. It can be used with any of the select tags in the JSF HTML tag library. The body content of this tag must be empty.<h:selectOneMenu id="list1">
<f:selectItem itemLabel="Option 1" itemValue="1"></f:selectItem>
</h:selectOneMenu>
<select id="list1" name="list1" size="1">
<option value="1">Option 1</option>
</select>
SelectItems:
SelectItems
tag adds a child UISelectItems
component to the component associated with enclosing tag. You can use this tag to set a list of objects in your domain model as the options for a select component. The body content of this tag must be empty.<h:selectManyListbox id="list">
<f:selectItems value="#{optionBean.optionList}"></f:selectItem>
</h:selectManyListbox>
<select id="list" name="list" multiple="true" size="-2147483648">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
</select>