[jboss-user] [JBoss Seam] - Re: i18n entity validation message?

pplaninsky do-not-reply at jboss.com
Sat Sep 9 18:59:01 EDT 2006


Hi,

I have tried to use notation like:
@Length(min=3, max=70, message="{testcustommessage}")
where testcustommessage is part of messages.properties.

My set up is:
* jboss 4.0.4GA (JEMS)
* SEAM 1.0.1GA
* SEAM booking application with messages properties added:

validator.assertFalse=assertion failed
validator.assertTrue=assertion failed
validator.future=must be a future date
validator.length=Length should be {min} and {max}
validator.max=must be less than or equal to {value}
validator.min=must be greater than or equal to {value}
validator.notNull=Not Null
validator.past=must be a past date
validator.pattern=must match "{regex}"
validator.range=must be between {min} and {max}
validator.size=size must be between {min} and {max}
validator.email=not a well-formed email address
testcustommessage=Test custom messages


I have these validators in the properties file, otherwise it won't work at all.
(I have understood that this is some problem in SEAM)

1. I am able to show the testcustommmessage in an xhtml page without a problem.
2. I can also use testcustommessage with FacesMessages.

3. When I try to use it in the @Length validator I always get an exception on JBOSS startup:

Caused by: java.util.MissingResourceException: Can't find resource for bundle java.util.PropertyResourceBundle, key testcustommessage
        at java.util.ResourceBundle.getObject(ResourceBundle.java:325)
        at java.util.ResourceBundle.getString(ResourceBundle.java:285)
        at org.hibernate.validator.ClassValidator.replace(ClassValidator.java:518)
        at org.hibernate.validator.ClassValidator.createValidator(ClassValidator.java:260)

I have tried to use:

@Length(min=3, max=70, message="{messages.testcustommessage}")

but it doesn't work too.

I have also tried with ValidatorMessages.properties in EJB root, META-INF, etc. None with success. Still getting the same exception.

Where I have to put the message.properties or ValidatorMessages.properties?

I am sure I am missing something, but I have started with Jboss a couple of weeks ago and I am not able to find the problem.
Please, can somebody help?

Thanks,
Philip

P.S.
I would be great if there are some documents and examples about htis problem and workarounds. It would be of great help to starters.


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3970559#3970559

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3970559



More information about the jboss-user mailing list