Xhtml页面:
<p:outputPanel id="customPanel" style="margin-bottom:10px;">
<p:selectOneRadio id="radiobutton" value="#{a.date}" layout="custom">
<f:selectItem itemLabel="Select Month:" itemValue="date" />
<f:selectItem itemLabel="Select Date :" itemValue="date1" />
<f:convertDateTime pattern="dd/MM/yyyy"/>
</p:selectOneRadio>
<p:panelGrid columns="3" cellpadding="0"
style="border:hidden; padding:1px;">
<p:radioButton id="opt1" for="radiobutton" itemIndex="0" />
<h:outputLabel for="opt1" value="Select Month:" />
<p:calendar pattern="MMM-yyyy" navigator="true" />
<p:radioButton id="opt2" for="radiobutton" itemIndex="1" />
<h:outputLabel for="opt2" value="Select Date :" />
<p:calendar navigator="true"/>
</p:panelGrid>
</p:outputPanel>
Bean类:
@ManagedBean(name="a")
public class A
{
private String date ;
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
System.out.println(" Date : " + date);
}
选择的日期值没有得到xhtml页面到bean类。当我选择任何单选按钮后单击提交按钮时显示错误.. form:radiobutton:&#39; date&#39;不能被理解为date.please建议解析将单选按钮值xhtml页面解析为bean类。