I have the following RichFaces (3.3.3) :
<rich:calendar id="richCal1"
value="#{user.CreateDate}"
popup="true" mode="client"
inputSize="20"
datePattern="dd/M/yyyy HH:mm"
enableManualInput="true"
buttonIcon="/images/calendar.gif">
<f:convertDateTime type="date" pattern="dd/MM/yyyy HH:mm" />
<a4j:support bypassUpdates="true" event="oninputblur" ajaxSingle="true" />
<a4j:support bypassUpdates="true" event="onchanged" ajaxSingle="true" />
</rich:calendar>
The backbean Variable Type is String as the the column where the Calendar appears is calculated dynamically based on user profile and can be one of many type of controls (Label,Input,SelectItem,Rich Calendar)....
The calendar works the first time the page loads and the correct value for RichCal1
is retrived and shown (in this case 05/03/2012 12:00:00
).
Problem occurs when the page needs to update (excuse the technically incorrect expression, i'll try and explain):
There is control on the page, where user can click and customize their current profile (additional rows or remove rows...etc). Once updated to reflect the change page needs to update which is where i see the following exception:
ERROR: org.ajax4jsf.webapp.BaseXMLFilter - Exception in the filter chain
javax.servlet.ServletException: myForm:0:richCal1: 'Mon Mar 05
12:00:00 EST 2012' could not be understood as a date.
I don't understand how the Date went from appearing as 05/03/2012 12:00:00
to 'Mon Mar 05 12:00:00 EST 2012
which is causing the issue.
Can someone please enlighten me.
Update:
Further debugging i discovered that when user updates/create a profile in another window, upon completion the process Refreshes the parent window. I set breakpoints on the setter/Getter of the Rich:Calendar value and i can see that first Getter is called and it has the correctly formatted date value, then the Setter is called which is set to Mon Mar 05 12:00:00 EST 2012
after which the exception is thrown! Anyone knows why this is happening?
I resolved the above issue by writing a
Converter
as below:Register it in
faces-config.xml
:and modified the rich:calendar to:
Hope that helps someone in similar position. Cheers