aspose file tools
The moose likes Struts and the fly likes Problems with MessageResources on my validation.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "Problems with MessageResources on my validation.xml" Watch "Problems with MessageResources on my validation.xml" New topic
Author

Problems with MessageResources on my validation.xml

Jesus Marin
Greenhorn

Joined: Oct 28, 2011
Posts: 1

Hello!!!

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">
<set-property
property="pathnames"
value="/WEB-INF/validation.xml,/org/apache/struts/validator/validator-rules.xml"/>
</plug-in>

and my validator.xml section

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

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: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Problems with MessageResources on my validation.xml
 
Similar Threads
multiple resource bundles and validation.xml on struts 1.1
custom validator and custom tags
Is it possible to use DynaActionForm for the following?
Struts Validator
struts validation example