This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan 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 Android Security Essentials Live Lessons this week in the Android 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
subject: Problems with MessageResources on my validation.xml
Similar Threads
multiple resource bundles and validation.xml on struts 1.1
Is it possible to use DynaActionForm for the following?
struts validation example
custom validator and custom tags
Struts Validator