Announcement Announcement Module
No announcement yet.
How to use parameters in Hibernate validation messages? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to use parameters in Hibernate validation messages?

    I uses Hibernate validation in a bean and defines the validation messages in a properties file. Is there any way to use parameters in the message? So I can use one validation message for all the fields that are required? Now each required field has a validation message, and it is really tedious. Thanks.

    	private String sampleId;
    form.sampleId.NotBlank=Sample ID is a required field.

  • #2
    There is a previous thread that talks about using parameters in a validation message. The thread is pretty long, but I think covers what you are asking:

    There is also a Jira issue regarding validation annotation ordering that was fixed in Spring 3.0.4. The issue is a good source of info on handling these parameters: