make your message resource as the defautl one, dont put any key just add the entry
<message-resources  parameter="MessageResources" />

in struts-config and see.,

Thanks & Regards,

Nuwan.



----- Original Message ----- From: "Dilip Ladhani" <[EMAIL PROTECTED]>
To: <user@struts.apache.org>
Sent: Wednesday, March 21, 2007 4:48 PM
Subject: Validator question Struts 1.2.9


I have gotten the validator to work in may of my projects, but I am
stuck on this one and was wondering if someone can help.
I have a MessageResources.properties under WEB-INF/classes which
contains all the messages.
In my struts-config I have the following line
<message-resources key="messages" parameter="MessageResources" />
Here is my validation.xml
       <form name="/showConfirmCompletedCourses">
           <field
               property="selectedCategory"
               depends="required">
                   <arg key="label.Category"/>
           </field>
           <field
               property="startDate"
               depends="required,date">
                   <arg key="label.StartDate"/>
                       <var>
                       <var-name>datePattern</var-name>
                       <var-value>MM/dd/yyyy</var-value>
                 </var>
           </field>
       </form>
I also tried putting <arg bundle="messages" key="label.Category"/>
I always get an exception when I validate. I call the form.validate
from my action class, I always get the following exception

2007-03-21 12:41:36,437] [location -
org.apache.commons.validator.ValidatorAction.executeValidationMethod(ValidatorAction.java:578)]
....Unhandled exception thrown during validation: No message resources
found for bundle: org.apache.struts.action.MESSAGE
java.lang.NullPointerException: No message resources found for bundle:
org.apache.struts.action.MESSAGE
at org.apache.struts.validator.Resources.getMessageResources(Resources.java:140) at org.apache.struts.validator.Resources.getActionMessage(Resources.java:349) at org.apache.struts.validator.FieldChecks.validateRequired(FieldChecks.java:94)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)

thanks

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to