-
Jan 14th, 2009, 09:43 AM
#1
Suppress Date Error (Annotation)
Hi,
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
#2
What error does the initBinder throw?
-
Jan 15th, 2009, 01:25 AM
#3
typeMismatch.java.util.Date
-
Jan 15th, 2009, 01:56 AM
#4
I think it's typeMismatch.fieldName
-
Jan 15th, 2009, 02:20 AM
#5
I define a initBinder like that:
SimpleDateFormat df = new SimpleDateFormat("dd.MM.yyyy", Locale.GERMAN);
df.setLenient(false);
CustomDateEditor editor = new CustomDateEditor(df, true, ZEHN);
binder.registerCustomEditor(Date.class, editor);
--> When the User enter a wrong date like : 32534
i get :
typeMismatch.java.util.Date exception
AND
I get my notnull exception
@NotNull(message = "blabla")
private Date datefield;
-
Jan 15th, 2009, 02:32 AM
#6
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
#7
this is clear. The Problem that i want to suppress the @NotNull Annotation when i have a typeMismatch.fieldName exception.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules