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
How to override validation rule's msg? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to override validation rule's msg?

    My validation.xml looks like so:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE form-validation PUBLIC 
        "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1//EN" 
            <form name="question">
    			<field property="content" depends="required,mask">
    				<arg0 key="labels.question" />
    I tried two things (both didn't work):
    1. <msg name="errors" key="errors.not.question" /> tag right before <arg0>
    2. Creating a new rule that was based on mask rule (via depends) with the msg I wanted.

    What am I doing wrong? I have the default errors.invalid and errors.required in file.

  • #2
    Messages can be over-ridden by nesting a <msg> element in your <field> element as shown in the following example:

    <field property="content" depends="required,mask" >
    <msg name="required" key="error.your.required" />

    where your new message is defined in your properties resource file using the specified key error.your.required.