Search code examples
javajsfrichfaces

Not able to get constant response


I am working on JSF and rich faces calendar.

<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>   

In my managed bean class i am using String as a argument in setting method:

 public void setSelectedDate(String selectedDate) {  
    System.out.println("Date is going to set:"+selectedDate+".");
    this.selectedDate = selectedDate;  
}  

Its work file when initially running it But when i open my.xhtml page once again then i am getting following error

'Wed Dec 07 12:00:00 PST 2011' could not be understood as a date.

Solution

  • It is because it is trying to restore the value from String to date on calendar component and which it is unable to do by it self so you need to use java.util.Date field in the bean to bind with