You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Scott Smith <ss...@mainstreamdata.com> on 2006/09/14 21:29:51 UTC

Configuring Struts Validator with Multiple Modules

I have a struts 1.2.9 app that has several modules (assume they are
named "a" and "b").  In my struts-config-a.xml file, I have a form
defined as followed:

 

    <form-bean name="formRegister"
type="a.modules.register.RegisterForm" />

 

My validation.xml file looks like:

 

<form-validation>

      <formset>

            <form name="formRegister" >

                  <field property="registerName" depends="required">

                  </field>

            </form>

      </formset>

</form-validation>

 

When I try to access the form, I get:

 

java.lang.IllegalArgumentException: Resources cannot be null.

      at
org.apache.commons.validator.Validator.<init>(Validator.java:188)

      at
org.apache.struts.validator.Resources.initValidator(Resources.java:475)

      at
org.apache.struts.validator.ValidatorForm.validate(ValidatorForm.java:10
4)

      ...

Based on some other posts, I think this is telling me it can't find any
validation information for my form ("formRegister")-which I assume means
that the name specified in my <form> tag is not what validator expects
to see for form within a module.  I've tried "a.formRegister" in my
<form> tag and that doesn't seem to work either.

 

I currently have a single validation.xml file.  The plugin is configured
in the main struts-config.xml file.  I assume I can only have one
incarnation of the validator plugin.  Is there something I need to put
in the individual module configuration files?  Do I really need to have
several invocations of the plugin?

 

Can someone give me some hints on configuring validator in a
multi-module struts app?

 

Thanks

 

Scott

 


Re: Configuring Struts Validator with Multiple Modules

Posted by Niall Pemberton <ni...@gmail.com>.
On 9/14/06, Scott Smith <ss...@mainstreamdata.com> wrote:
> I have a struts 1.2.9 app that has several modules (assume they are
> named "a" and "b").  In my struts-config-a.xml file, I have a form
> defined as followed:
>
>     <form-bean name="formRegister"
> type="a.modules.register.RegisterForm" />
>
> My validation.xml file looks like:
>
> <form-validation>
>       <formset>
>             <form name="formRegister" >
>                   <field property="registerName" depends="required">
>                   </field>
>             </form>
>       </formset>
> </form-validation>
>
> When I try to access the form, I get:
>
> java.lang.IllegalArgumentException: Resources cannot be null.
>       at
> org.apache.commons.validator.Validator.<init>(Validator.java:188)
>       at
> org.apache.struts.validator.Resources.initValidator(Resources.java:475)
>       at
> org.apache.struts.validator.ValidatorForm.validate(ValidatorForm.java:10
> 4)
>       ...
>
> Based on some other posts, I think this is telling me it can't find any
> validation information for my form ("formRegister")-which I assume means
> that the name specified in my <form> tag is not what validator expects
> to see for form within a module.  I've tried "a.formRegister" in my
> <form> tag and that doesn't seem to work either.
>
> I currently have a single validation.xml file.  The plugin is configured
> in the main struts-config.xml file.  I assume I can only have one
> incarnation of the validator plugin.  Is there something I need to put
> in the individual module configuration files?  Do I really need to have
> several invocations of the plugin?

Yes, you need to configure the validator plugin for each module.

Niall

> Can someone give me some hints on configuring validator in a
> multi-module struts app?
>
> Thanks
>
> Scott

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org