-
1. Re: i18n validation message during test
gavin.king Sep 14, 2006 11:55 AM (in response to atao)Yes, Hibernate Validator wants you to use:
@NotNull(message="{booking.credit.card.not.null}")
However, Emmanuel and I are currently working on some integration b/w Seam and Hibernate Validator so that you can use #{messages['...']} for consistency. -
2. Re: i18n validation message during test
atao Sep 14, 2006 2:05 PM (in response to atao)ATM, in a deploiement under jBoss server,
@NotNull(message="#{messages['booking.credit.card.not.null']}")
works with messages_loc.properties under {booking_home}/resources/WEB-INF/classes
and
@NotNull(message="{booking.credit.card.not.null}")
doesn't work even with ValidatorMessages_loc.properties under {booking_home}/resources/WEB-INF/classes.
I don't see what is wrong!
Pierre -
3. Re: i18n validation message during test
gavin.king Sep 14, 2006 2:33 PM (in response to atao)Oh, I'm wrong, #{messages['booking.credit.card.not.null']} does work after all.
-
4. Re: i18n validation message during test
atao Sep 14, 2006 2:56 PM (in response to atao)Ok
So I come back to my first question: I get the literal string
#{message['any.key']}
and not the associated pattern when I test BookingTest.renderResponse
is it the expected behavior? -
5. Re: i18n validation message during test
gavin.king Sep 14, 2006 4:20 PM (in response to atao)message!=messages
-
6. Re: i18n validation message during test
atao Sep 14, 2006 6:59 PM (in response to atao)Oups! Sorry, the mistake is only here. The code is really like:
@Length(min=16, max=16, message="#{messages['booking.credit.card.number.wrong.length']}")
and during test, ( (FacesMessage) messages.next() ).getSummary() returns
#{messages['booking.credit.card.number.wrong.length']} -
7. Re: i18n validation message during test
rlhr Nov 26, 2006 11:58 AM (in response to atao)Hello,
I tried to setup custom messages for the hibernate validation annotation but without success yet.
I have a ValidatorMessages.properties (defining all the default message for hibernate validators) file in my ear file so that I don't get an exception at server startup.
All my properties file are under WEB-INF/classes in the war file.
In compoments.xml, I define all these files and everything works fine except validations still return the default "Validation Error" message.
I also tried to define the following in the faces-config.xml:<message-bundle>ValidatorMessages</message-bundle> <locale-config> <default-locale>en</default-locale> <supported-locale>en</supported-locale> <supported-locale>fr</supported-locale> </locale-config>
But it didn't change anything...
I tried to use both syntax:@NotNull(message="{validator.my.message}") and @NotNull(message="#{messages['validator.my.message']}")
Without much success.
Does anyone know how to set this up? I'm sure I must have missed something somewhere, but I can't see what.
Thanks,
Richard -
8. Re: i18n validation message during test
atao Nov 26, 2006 2:44 PM (in response to atao)Richard
read the thread
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=93507
to get some more explanations about NotNull annotation and validation tag.
Pierre -
9. Re: i18n validation message during test
rlhr Nov 26, 2006 4:35 PM (in response to atao)Hi Pierre,
Thanks for the link, I'm going to take a look at it.
Richard