📜  Primefaces Selectonelistbox

📅  最后修改于: 2021-01-08 04:10:50             🧑  作者: Mango

PrimeFaces SelectOneListbox

它是标准selectOneListbox组件的扩展版本。它用于从列表中选择一个值。 PrimeFaces提供了组件来创建列表框。当我们希望从多个选项中获得用户的选择时,这很有用。它具有下表列出的各种属性。

SelectOneListbox属性

Attribute Default value Return type Description
id null String It is an unique identifier of the component.
rendered true Boolean It is used to render component. It takes boolean value.
binding null object It is used to set an expression that maps to a server side UIComponent
instance in a backing bean
value null object It is used to set value of the component referring to a List.
converter null Converter/String It is used to set text that defines a converter for
the component.
required false Boolean It is used to make component as required
widgetVar null String It is a name of the client side widget.
disabled false Boolean It is used to disable the component.
label null String It is used to set user presentable name.
var null String Name of iterator to be used in custom content
display.
filter false boolean Displays an input filter for the list.
filterMatchMode null String Match mode for filtering, valid values are
startsWith (default), contains, endsWith and
custom.
filterFunction null String Client side function to use in custom
filterMatchMode.
caseSensitive false Boolean Defines if filtering would be case sensitive.
scrollHeight null Integer Defines the height of the scrollable area.

在下面的示例中,我们正在实现组件。本示例包含以下文件。

JSF文件

// listbox.xhtml





Listbox





















ManagedBean

// ListBox.java

package com.javatpoint;
import javax.faces.bean.ManagedBean;
@ManagedBean
public class ListBox {
private String option;   
public String getOption() {
return option;
}
public void setOption(String option) {
this.option = option;
}
}

输出: