Results 1 to 3 of 3

Thread: How to include JSR-303 validation annotation's attribute into validation message?

Threaded View

  1. #1
    Join Date
    Mar 2008
    Posts
    29

    Exclamation How to include JSR-303 validation annotation's attribute into validation message?

    How to include validation annotation's attribute into validation message?

    There are snapshots from my application below:

    Form Object:
    ...
    @Size(min = 6)
    private String password;
    ...
    validation.properties:
    Size.password = Password should be at least {min} characters
    Without {min} message is displayed successfully on the page, if {min} is included I get:
    Caused by: java.lang.IllegalArgumentException: can't parse argument number min
    The key word here is "number". If I write Size.password = Password should be at least {2} characters, actually it works, and min value will be displayed (I found this arg number during inspecting BindingResult object after validation is applied in my controller). But this is weird.

    What is right configuration for spring web mvc project to able support for validation annotation attribute's values in the message source?

    Thank you.
    Last edited by Aliaksandr; Jan 8th, 2012 at 03:38 PM.

Tags for this Thread

Posting Permissions

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