我正在研究 JSF 和 Rich Faces 日历。
<rich:panel header="Richfaces Calendar" style="width:600px">
<rich:calendar value="#{CalenderBean.selectedDate}" id="calendar" datePattern=
"d/M/yy HH:mm" cellWidth="50px" cellHeight="50px" disabled="false"
buttonLabel="Open Calendar" popup="true" >
<a4j:support event="onchanged" reRender="changeDate"/>
</rich:calendar>
<h:panelGroup id="changeDate">
<h:outputText value="#{CalenderBean.selectedDate}" />
</h:panelGroup>
</rich:panel>
在我的托管 bean 类中,我使用 String 作为设置方法中的参数:
public void setSelectedDate(String selectedDate) {
System.out.println("Date is going to set:"+selectedDate+".");
this.selectedDate = selectedDate;
}
最初运行时的工作文件但是当我再次打开 my.xhtml 页面时,我收到以下错误
'Wed Dec 07 12:00:00 PST 2011' could not be understood as a date.
最佳答案
这是因为它试图将值从 String 恢复到日历组件上的日期,而它自己无法完成此操作,因此您需要使用 bean 中的 java.util.Date
字段进行绑定(bind)
关于java - 无法得到持续的响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8338429/