Announcement Announcement Module
Collapse
No announcement yet.
Hibernate Validation doesn't display custom error messages in JSF 2 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Hibernate Validation doesn't display custom error messages in JSF 2

    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.
Working...
X