Announcement Announcement Module

Spring Modules forum decommissioned in favor of Spring Extensions

As the Spring Modules project has been replaced by the Spring Extensions ( project, this forum has been decommissioned in favour of Spring Extensions one at:

Please see the Spring Extensions home page for a complete list of current projects in Java, .NET and ActionScript. You can also propose one if you want.

Costin Leau
SpringSource - Spring Training, Consulting, and Support - "From the Source"
See more
See less
annotation-based bean validation error messages Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • annotation-based bean validation error messages


    I'm investigating an annotation-based approach to command bean validation using spring modules. In the tutorial, the following command bean (getters and setters omitted) is used:

    public final class UserMessage {  
      @Length(max = 80)  
      private String name;  
      @Length(max = 80)  
      private String email;  
      @Length(max = 4000)  
      private String text;  
    And the following are (some of the) configured error messages:

    Code:[not.blank]=Please enter your e-mail address.[email]=Please enter a valid e-mail address.[length]=Please enter no more than {2} characters.
    The net effect is that if the rule about e-mail length is not observed, the message produced is:

    "Please enter no more than 80 characters"

    Where are the values substituted for each of the {} placeholders documented? In other words, how can I find out what will be substituted for {0}, {1},...,{N} for a particular validation rule?

    Thanks in advance,
    Last edited by domurtag; Jul 30th, 2008, 08:10 PM.