JSF set default value Radio Button h:selectOneRadio [closed]

心已入冬 提交于 2020-01-24 09:06:31

问题


<h:selectOneRadio id="radio1" value="#{testBean.value}">
    <f:selectItem itemValue="High School" itemLabel="High School" />
    <f:selectItem itemValue="Bachelor's" itemLabel="Bachelor's"/>
    <f:selectItem itemValue="Master's" itemLabel="Master's"/>
    <f:selectItem itemValue="Doctorate" itemLabel="Doctorate" />
</h:selectOneRadio>

回答1:


Set value in your backing bean with the desired default value. For example if you want "High School" as default:

value = "High School";

This can be done in the constructor or in an @PostConstruct method depending on the scope of your backing bean.



来源:https://stackoverflow.com/questions/5893707/jsf-set-default-value-radio-button-hselectoneradio

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!