Announcement Announcement Module
Collapse

Spring Modules forum decommissioned in favor of Spring Extensions

As the Spring Modules project has been replaced by the Spring Extensions (http://www.springsource.org/extensions) project, this forum has been decommissioned in favour of Spring Extensions one at:
http://forum.springsource.org/forumdisplay.php?f=44

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.

Cheers,
Costin Leau
SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
http://twitter.com/costinl
See more
See less
default messages to annotation validations Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • default messages to annotation validations

    I'm unable to get the default message to the validations on springmodules, i send my configuration:

    in applicationResources.properties, i have
    Code:
    # message errors for the class User
    #User.name[not.blank]=Name is required
    User.surname[not.blank]=Surname is required
    User.email[not.blank]=Email is required
    User.email[email]=Not a valid email
    User.ssoId[validateSsoIdLength()]=Sso Id length incorrectly
    
    # message errors by default
    not.blank=Required default
    not.null=Required default
    expression=Invalid default
    email=Invalid email default
    length=Must be between {1} to {2} characters long default
    min.length=Must be at least {1} characters default
    max.length=Cannot be longer than {1} characters default
    In my bean, i have annotations to make the validation, and it works good.
    My problem is, that if i comment by example #User.name[not.blank] as you can see in the code, i can't get the default message "Required default" that must appear because of the properties.
    I get the errors defined for the bean, but not the default errors.
    I also try with

    Code:
    errors.not.null={0} is a required field df.
    errors.not.blank={0} is a required field df.
    and doesn't work neither.

    In the jsp (the form that bind with the bean, i have the next code):
    Code:
    <form:errors path="*">
    		<div class="errors">
    			<p><em><fmt:message key="errors.following.encountered"/></em></p>
                <ul>
                	<c:forEach items="${messages}" var="message">
    					<li>${message}</li>
    				</c:forEach>
                </ul>
                <p><fmt:message key="errors.data.hasnotsaved"/></p>
    		</div>
    	</form:errors>


    What are the default message properties for the annotation based validator?
    Thanks, and sorry for my bad english.
    Last edited by cclafuente; Oct 16th, 2007, 02:56 AM. Reason: add new information

  • #2
    you might be interested in this post-

    http://stackoverflow.com/questions/1...ean-validation

    Comment

    Working...
    X