这里是mycode:可能有一些错误,但我做得对,我认为我的问题是在Java代码中请你点亮,我试图渲染无线电值。
<p:selectOneRadio id="firstBill" value="#{myClass.myfee}" label="what to do?">
<f:verbatim>
<f:selectItems value="#{myClass.listMyFee}"/>
</f:verbatim>
</p:selectOneRadio>
@Name("myClass")
public class MyClass
{
private String fee;
private Map<String, String> listMyFee;
public Myclass(){
//constructor
listMyFee = new LinkedHashMap<String, String>();
listMyFee;.put("Yes", "Yes");
listMyFee;.put("No", "No");
}
public Map<String, String> getListMyFee()
{
return this.listMyFee;
}
get and set for fee are written
答案 0 :(得分:0)
您的bean代码错误,您需要f:selectItems
List<SelectItem>
列表。
看起来像这样:
List<SelectItem> list = new LinkedList<SelectItem>();
list.add(new SelectItem(<returnValue>, <displayValue>));
在你的xhtml文件中:
<p:selectOneRadio id="firstBill" value="#{myClass.myfee}" label="what to do?">
<f:selectItems value="#{myClass.list}" />
</p:selectOneRadio>