SelectOneButton is used to choose a single item from a list using buttons.
<div class="card">
<h:form>
<p:selectOneButton value="#{selectOneButtonView.option}">
<f:selectItem itemLabel="Option1" itemValue="Option1"/>
<f:selectItem itemLabel="Option2" itemValue="Option2"/>
<f:selectItem itemLabel="Option3" itemValue="Option3"/>
</p:selectOneButton>
</h:form>
</div>
@Named
@RequestScoped
public class SelectOneButtonView {
private String option;
public String getOption() {
return option;
}
public void setOption(String option) {
this.option = option;
}
}