📜  Primefaces布尔按钮

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

PrimeFaces SelectBooleanButton

用于在JSF应用程序中创建BooleanButton。我们可以使用它来获取用户的布尔输入。它提供了一个与用户交互的切换按钮。

SelectBooleanButton属性

下表包含InputTextarea组件的属性。

Attribute Default value Return type Description
id null String It is an unique identifier of the component.
rendered true Boolean It returns boolean value to specify the rendering of the component.
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 holds value of the component referring to a List.
converter null Converter/String It is used to set an expression or a literal text that defines a converter
for the component.
immediate false Boolean It is used to set boolean value. If value is true, process validations logic is executed at
apply request values phase for this component.
required false Boolean It is used to make component as required.
requiredMessage null String It is used to set message to be displayed when required field validation
fails.
onchange null String It is used to call a method on value change.
style null String It is used to set Inline style of the component.
onIcon null String It is used to set icon to display when button is selected.
offIcon null String It is used to set icon to display when button is unselected.
onfocus null String It executes when button receives focus.
onblur null String It executes when button loses focus.

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

JSF文件

// boolean-button.xhtml





Boolean Button


PrimeFaces Boolean Button Example

ManagedBean

// BooleanButton.java

package com.javatpoint;
import javax.faces.bean.ManagedBean;
@ManagedBean
public class BooleanButton {
private boolean checkValue;   
public boolean isCheckValue() {
return checkValue;
}
public void setCheckValue(boolean checkValue) {
this.checkValue = checkValue;
}
}

输出:

单击按钮后,它切换为是。