On 3/21/07, Dilip Ladhani <[EMAIL PROTECTED]> wrote:
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

If you're not using the "default" bundle then you need to specify the
bundle for all the messages as well - so you would have to add <msg>
elements for both the "required" and "date" validator in the above
example (with the "bundle" attribute specified).

Niall

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