This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Struts and the fly likes Problems with MessageResources on my validation.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problems with MessageResources on my validation.xml" Watch "Problems with MessageResources on my validation.xml" New topic

Problems with MessageResources on my validation.xml

Jesus Marin

Joined: Oct 28, 2011
Posts: 1


I'm having problems with my application trying to configure a separate MessageResources for validation. I have two MessageResources: one for common messages and other just for error messages.
Problems come when I try to use it cause I always get the same error: Cannot find message resources under key org.apache.struts.action.MESSAGE. I think it's because in validator.xml i 've used the bundle attribute with arg field and the application can't relate this attribute with message resource files.

There'are some configuration fragments to clarify this:

my struts-config.xml 's section relative to validation and message-resources:

<message-resources parameter="i18n.templateMessages.MessageResources" key="templateMessages" null="false"/>
<message-resources parameter="i18n.errorMesages.MessageResources" key="errorMessages" null="false"/>
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">

and my validator.xml section

<form name="registerForm" >
<field property="user" depends="required">
<arg key="registerForm.user" bundle="errorMessages"/>
<field property="password" depends="required">
<arg key="registerForm.password" bundle="errorMessages" />

I switched between the bundles and despite the fact that both work well if i use them with struts tags, there's no way to make them work with validation. The only way i found to run it correctly was declaring a <message-resources> element without key and it works, but i suppose that it may work using keys to identify different <message-resources> (it looks more clear)

Has anybody some ideas about that?
Thanks to everybody
I agree. Here's the link:
subject: Problems with MessageResources on my validation.xml
It's not a secret anymore!