📜  Primefaces Selectonebutton

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

PrimeFaces SelectOneButton

它用于使用按钮从列表中选择单个项目。它创建项目列表作为按钮列表。因此,我们可以通过单击按钮来选择项目。 组件用于在JSF应用程序中创建按钮列表。它具有下表列出的各种属性。

SelectOneButton属性

Attribute Default value Type Description
id null String It is an unique identifier of the component
rendered true Boolean It is used to specify the rendering of the
component.
required false Boolean It is used to mark component as required.
converterMessage null String It is used to set message to be displayed when conversion fails.
disabled false Boolean It is used to disable the component.
label null String It is used to set label for the component.
onchange null String It is used to call script on value change.
style null String It is used to set inline CSS of the component.
tabindex 0 String It is used to set position of the element in the tabbing order.
unselectable true Boolean It is used to unselect the component.

剥皮

以下是结构样式类的列表;

Style Class Applies
.ui-selectonebutton It applies on main container element.

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

JSF文件

// oneButton.xhtml





One Button


















ManagedBean

// OneButton.java

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

输出: