-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Hibernate Validation doesn't display custom error messages
PostPosted: Thu Nov 03, 2011 12:12 pm 
Newbie

Joined: Sun Oct 30, 2011 5:43 am
Posts: 13
i am using hibernate validation (4.2.0 Final) with JSF 2 and Spring
and here's my configuration:

1- applicationContext:


Code:
<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
       <property name="basenames">
       <list>
       
       <value>classpath:messages/ValidationMessages</value>
       <value>classpath:messages/application</value>
         
       </list>
       </property>
       <property name="defaultEncoding" value="UTF-8"/>
       </bean>


2- faces-config.xml:

Code:
<resource-bundle>
              <base-name>messages.ValidationMessages</base-name>
           </resource-bundle>


when trying to use the following:

Code:
@NotBlank(message = "{name.required}")
    private String name;


it doesn't work, it doesn't display the message from property file, it displays {name.required}

please advise why it's not working.


Top
 Profile  
 
 Post subject: Re: Hibernate Validation doesn't display custom error messages
PostPosted: Mon Nov 07, 2011 5:02 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

I think this question is more targeted for the Spring forum, because you are using Spring specific classes and configuration. Don't you have to somewhere tell the Validator to use the message source - see http://stackoverflow.com/questions/7688 ... -validator?

--Hardy


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.