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
Bean validation & message sources Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bean validation & message sources

    Hi

    Could someone please help me find out why bean validation doesn't pickup the message resources I defined in my application context?

    My message source declaration:

    Code:
    <bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
        <property name="basename" value="messages" />
        <property name="cacheSeconds" value="1" />
    </bean>
    My bean validator declaration:

    Code:
    <bean id="beanValidator" class="org.springmodules.validation.bean.BeanValidator">
    	<property name="configurationLoader" ref="configurationLoader" />
    </bean>
    
    <bean id="configurationLoader" class="org.springmodules.validation.bean.conf.loader.xml.DefaultXmlBeanValidationConfigurationLoader">
    	<property name="resource" value="classpath:validation.xml" />
    </bean>
    When validation fails on a property of an object, my controller shows the actual message code, example:

    Code:
    not.blank
    But should be:

    Code:
    Can not be blank.
    Because I have the following in my messages.properties:

    Code:
    not.blank=Can not be blank.
    Any ideas?

    Thanks
    Last edited by newreaders; Oct 5th, 2007, 09:48 AM. Reason: Solved

  • #2
    I have fixed the problem by setting the KeepAsIsErrorCodeConverter.

    Thanks

    Comment

    Working...
    X