spring 3 validation example

12,203

This is a good link to start with Spring 3 validation Spring 3 MVC: Show validation message with custom validator.

for reading properties file use:

ValidationUtils.rejectIfEmpty(errors, "userId", "field.required");

in Validation class. and using

<bean id="messageSource"
        class="org.springframework.context.support.ResourceBundleMessageSource">
        <property name="basename" value = "messages" />
    </bean>

in dispatcher-servlet.xml file to load message.properties file.

And it is working fine..
Cheers
Shams

Share:
12,203

Related videos on Youtube

Shams
Author by

Shams

Updated on June 04, 2022

Comments

  • Shams
    Shams almost 2 years


    Can anybody give me a link for Spring 3.0 Validation, by extending org.springframework.validation.Validator or javax.validation Interface and reading error messages from properties file?

    Thanks
    Shams

Related