Did you remember to extend ValidatorForm or ValidatorActionForm? On a side note, with the ValidatorForm, you also have to define an input="/SomeAction.do" inside of your <action..> tag so struts knows where to forward to if there is an error. The input can also refer to a jsp page or a tiles def.
<action path="/HotelSave" type="hotel.HotelSaveAction" name="HotelForm" validate="true" scope="request" input="hotelEdit"> <forward name="hotelDisplay" path="hotelDisplay" redirect="false" /> </action> -ET > -----Original Message----- > From: otisg [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, February 04, 2003 3:16 PM > To: [EMAIL PROTECTED] > Subject: Validator won't kick-in > > > Hello, > > I am trying to use Commons Validator with > Struts, but I can't get it to 'kick in'. I > am using the CVS HEAD version of Struts and > Taglibs, and Validator I just built from CVS > the other day. > > My Struts config has a 'loginForm' defined as: > > <form-bean name="loginForm" > > type="org.apache.struts.validator.DynaValidatorForm"> > <form-property name="username" > type="java.lang.String"/> > <form-property name="password" > type="java.lang.String"/> > </form-bean> > > > The 2 Validator's files are defined properly > in Struts config via <plugin>. > > IN Struts config I have /Login action tied > to the loginForm form. I also have > validate="true" set in the action mapping > (is this needed?). > > > In my JSP that contains this loginForm I > have action=/Login in the HTML form. Fields > are 'username' and 'password'. > > > My validation.xml contains: > > <form name="loginForm"> > <field property="username" > depends="required"> > <msg name="required" > key="Required Called" resource="false"/> > </field> > <field property="password" > depends="required"> > </field> > </form> > > > My Action class does not contain any code > that calls form.validate(mapping, request). > I don't think this is needed - I think > everything should work as defined > declaratively in these files....automagically :) > ... > ...but it does not do that (for me) :( > > > I've read Chapter 11 of Cavaness' book a few > times and according to him what I described > above should suffice. > > When I go to my login page with the login > form and leave the username completely blank > I expect to get an error...but I don't get it. > > One more thing that may be worth mentioning, > my Action class has: > > return mapping.findForward("success"); > > And the JSP defined for this "success" contains: > > <html:errors/> > > I expect this to show me Validator's errors. > I get no application errors, all looks good, > too good - I want to see that error about a > missing required username field :) > > Thanks, > Otis > > > ________________________________________________ > Get your own "800" number > Voicemail, fax, email, and a lot more > http://www.ureach.com/reg/tag > > --------------------------------------------------------------------- > 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]