I have a newbie-ish question on formatting data from rich:calendar. I need to convert the calendar date into a java.sql.Timestamp value for persistence into a database. The calendar is part of a larger form, and I've run into problems saving the date value when submitting the form data.
I've fixed the problem with the change listener, but the listener persists the data immediately.
Calendar:
<rich:calendar id="talkstart" value="#{TalkInfoBean.talkstart}" popup="true" datePattern="yyyy-MM-dd HH:mm" valueChangeListener="#{TalkInfoBean.updateTalkStart}" showWeeksBar="false" showApplyButton="true"> <a4j:support event="onchanged" /> </rich:calendar>
public void updateTalkStart(ValueChangeEvent e) { Date newdate = (Date) e.getNewValue(); Timestamp t = new Timestamp(newdate.getTime()); this.setTalkstart(t); }
Hello,
Exactly, with converter.