Announcement Announcement Module
Collapse
No announcement yet.
CustomDateEditor and exception Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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.

    Comment


    • #3
      That's it !

      :-) Thanks for your answer

      Comment

      Working...
      X