Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problems with MessageResources on my validation.xml

Jesus Marin
Posts: 1
Eclipse IDE Tomcat Server Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic