java Primefaces SelectOneRadio,选择了NoSelection选项
如何使selectOneRadio具有默认选中的NoSelection选项
我有以下资料:
<p:selectOneRadio>
<f:selectItem itemLabel="none" noSelectionOption="true"/>
<f:selectItems value="#{bean.anything}"/>
</p:selectOneRadio>
我想在默认情况下选择“无”?我该怎么做?因为没有“选定”的属性
# 1 楼答案
使用绑定到视图的托管bean字段,其值为
null
,还可以使用未选择的选项,其值为null
JSF部分:
托管bean代码: