Jan 14th, 2009, 09:43 AM
Suppress Date Error (Annotation)
i use the initBinder to check a date.
i also use a @NotNull annotation for this date.
The problem is that i get 2 errors when i have a wrong date.
1. Init Binder Error
2. Date is NotNull
Is there a possibility to suppress the annotation error, when the initbinder throws an error ?
Jan 15th, 2009, 01:04 AM
What error does the initBinder throw?
Jan 15th, 2009, 01:25 AM
Jan 15th, 2009, 01:56 AM
I think it's typeMismatch.fieldName
Jan 15th, 2009, 02:20 AM
I define a initBinder like that:
SimpleDateFormat df = new SimpleDateFormat("dd.MM.yyyy", Locale.GERMAN);
CustomDateEditor editor = new CustomDateEditor(df, true, ZEHN);
--> When the User enter a wrong date like : 32534
i get :
I get my notnull exception
@NotNull(message = "blabla")
private Date datefield;
Jan 15th, 2009, 02:32 AM
If you have a error resource bundle configured just put a new entry in it with the key typeMismatch.fieldName. Whenever there is an exception while parsing the data, the error will show up instead of an exception.
Jan 15th, 2009, 03:04 AM
this is clear. The Problem that i want to suppress the @NotNull Annotation when i have a typeMismatch.fieldName exception.