Results 1 to 3 of 3

Thread: CustomDateEditor and exception

  1. #1

    Default CustomDateEditor and exception

    Hi,

    I like to have an explicit message to the user field date when an error occur instead of the english message 'failed to convert.....'. But how ?

    My register date editor :
    SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
    binder.registerCustomEditor(java.util.Date.class, null, new CustomDateEditor(dateFormat,false));

    Thanks,

    Fabien.

  2. #2
    Join Date
    Aug 2004
    Location
    Mount Joy, PA
    Posts
    34

    Default

    I think you are asking how to customize the error message that appears when the conversion is not successful. This is done by adding messages to your messages.properties (or whatever it is named) file like this:

    Code:
    typeMismatch.java.util.Date=The value must be a date in the form 'dd/MM/yyyy'.
    More information can be found in the documentation for DefaultMessageCodesResolver.
    ~ Daniel Miller

  3. #3

    Default That's it !

    :-) Thanks for your answer

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •