📜  Primefaces Selectoneradio

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

PrimeFaces SelectOneRadio

它用于从选项列表中选择一个项目。它是带有主题集成的扩展版本。 组件用于创建单选按钮列表。当我们希望用户提供单个输入时,这很有用。它具有下面列出的各种属性。

SelectOneRadio属性

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.
value null Object It is used to set value of the component referring to a List.
required 0 Boolean It is used to mark component as required.
valueChangeListener null MethodExpr It is used to refer a method for handling a value change event.
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.
layout line
Direction
String It is used to set layout of the radio button.
columns 0 Integer It is used to set number of columns in grid layout.
onchange null String It is used to execute method on value change.
style null String It is used to set inline CSS of the component.
tabindex null String It specifies the tab order of element in tab navigation.
plain false Boolean It displays plain mode of radiobuttons.

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

JSF文件

// oneRadio.xhtml





OneRadio



PrimeFaces OneRadio Example

ManagedBean

// OneRadio.java

package com.javatpoint;
import javax.faces.bean.ManagedBean;
@ManagedBean
public class OneRadio {
private String car;
public String getCar() {
return car;
}
public void setCar(String car) {
this.car = car;
}
}

输出: