A couple of things:
1. Not sure what version of Struts you're using, but at least according
to
http://struts.apache.org/1.2.9/userGuide/building_view.html#validator,
the "property" attribute for the validator should have the value of
"pathnames" and not the path of your action.
It's ok I had just tried with that value for test.. but it doesn't work :-/
2. Make sure your bean extends ValidatorForm (or the Dyna one if using
dyna forms...)
yes, i'st ok
Fix the above and see what happens. If it's still not working, override
the validate(...) method in your validator form bean and throw either
some System.out's or Logger.log statements in there to make sure it's
even being called. Also, if you override, make sure you call
super.validate to get any errors you've defined in your validation XML.
Should I really override that method ???
Hope this helps...
cheers,
-adam
Jeremy Jardin wrote:
> Hi,
>
> I'm trying to use validator plugin in my application, and it does not
> work
> at all !
>
> First, I've just add <html:errors/> in my jsp.
>
> I've written a basic validation.xml file like this :
> <form name="StartSubscriptionForm">
> <field property="name" depends="required">
> <arg0 key="inscription.nom"/>
> </field>
> </form>
>
> Then, I've also a classic validation-rules.xml file, with usefull rules.
> Thoses files are un my WEB-INF directory.
>
> I added in my struts-config.xml fil those lines :
>
> <form-beans>
> <form-bean name="StartSubscriptionForm" type="
> sapinscription.form.StartSubscriptionForm"/>
>
> </form-beans>
>
> <!-- ========== Action Mapping Definitions
> ==============================
> -->
> <action-mappings>
>
> <action path = "/StartSubscription"
> type =
> "sapinscription.action.StartSubscriptionAction"
> name = "StartSubscriptionForm"
> scope = "session"
> validate = "true"
> input = "/jsp/inscriptionForm.jsp"
> >
> <forward name="subscribingPage" path="/jsp/inscriptionForm.jsp"
> />
> </action>
>
> </action-mappings>
>
> <message-resources null="false" parameter="conf.WebMessages"/>
>
> <!-- ============== Validator plugin
> ======================================-->
>
> <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
> <set-property
> property="/StartSubscription"
> value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
> </plug-in>
>
>
> It seems to be all right.. but when I submit my form, Action class
> runs.. as
> if validation were ok.. even if I do not fill "name" field in my form?
>
> I guess there's something wrong.. but I don't know where ?
>
> Help please !
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
~ jebmail ~