Hi All,
I am not able to set current date for <af:inputDate> component.
There are two date components on my JSPX :
From Date and
To Date.
These attributes are not VO based but page is VO based.
I did bindings for these two components in bean as
dtFrom and
dtTo
Sample JSPX code,
<af:inputDate label="From Date" id="fromDate" binding="#{myBean.dtFrom}" value="#{myBean.dtFrom}"/>
<af:inputDate label="To Date" id="toDate" binding="#{myBean.dtTo}" value="#{myBean.dtTo}"/>
Sample code from myBean,
public void setDtFrom(RichInputDate dtFrom) {
this.dtFrom = dtFrom;
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("mm/dd/yyyy");
this.dtFrom.setValue(sdf.format(cal.getTime()));
}
public RichInputDate getDtFrom() {
return dtFrom;
}
public void setDtTo(RichInputDate dtTo) {
this.dtTo = dtTo;
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("mm/dd/yyyy");
this.dtTo.setValue(sdf.format(cal.getTime()));
}
public RichInputDate getDtTo() {
return dtTo;
}
On page load, it is showing current dates but when I click on Submit button to submit the form;it is showing error:
Could not convert instance:Thu May 05 00:00:00 IST 2011 of type:class java.util.Date into type:class oracle.adf.view.rich.component.rich.input.RichInputDate
Is there any way set current date as default date on page load without using code in bean, as I did!!!
Appreciate your help.
Thanks and Regards,
Madhav K.