Alot of our date related fields use java.util.Calendar instead of java.util.Date.
<p:calendar id="blah" value="#{myBean.myObject.myDate.time}" />
I get errors at runtime if field myDate (which is a java.util.Calendar) is null.
Is there a way around this?
Using java.util.Calendar with the calendar form element
- bumble.bee
- Posts: 723
- Joined: 29 Sep 2010, 21:39
- Location: United States
Just set a default value in your bean. [something like Calendar.getInstance();]
I had to add a custom converter allow the primefaces Calendar component to convert to and from a java.util.Calendar.
While not ideal, I used the code that primefaces uses to convert to and from java.util.Date after getting or setting the date from the java.util.Calendar object.
It would be nicer if primefaces either supported this natively or if there at least was a primefaces DateTimeConverter that I could extend.
While not ideal, I used the code that primefaces uses to convert to and from java.util.Date after getting or setting the date from the java.util.Calendar object.
It would be nicer if primefaces either supported this natively or if there at least was a primefaces DateTimeConverter that I could extend.
-
- Information
-
Who is online
Users browsing this forum: No registered users and 29 guests