VwpFAQInputCalFormat

Why do I get Unknown Format error when committing my Calendar value to my DB?


I have bound a database field to the selected date property of the calendar component. The date is displayed correctly in the designer and at runtime but when I try to commit data to the Database (eg. using a oracle database with a column of type DATE) it gives me an exception, that it is an object of unknown format. How do I fix this?

Instead of directly binding to the date column, use a property called Date (see the code below) in the Page1.java and bind that property to the Calendar

public java.util.Date getDate(){
return (java.util.Date) getValue("#{currentRow.value[TRIP.DEPDATE]}");
}

public void setDate(java.util.Date date){
return setValue("#{currentRow.value[TRIP.DEPDATE]}", new
java.sql.Date(date.getTime())));
}

For more detail see blog: http://blogs.sun.com/roller/page/winston?entry=adding_calendar_to_table

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo