Here are a couple of things to check: * Do you have both the validation.xml and validator-rules.xml files in your WEB-INF directory? * How have you defined your ActionForm? It needs to be either a (subclass of) ValidatorForm or DynaValidatorForm. * Have you tried using session scope for the action?
Hope that helps, Vil. -- Vilya Harvey, Consultant [EMAIL PROTECTED] / digital steps / (W) +44 (0)1483 469 480 (M) +44 (0)7816 678 457 http://www.digitalsteps.com/ ----- Original Message ----- From: "Kilmer, Erich" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, September 24, 2002 2:47 PM Subject: Can't get Validator to validate required ... what am I missing? > I recently downloaded the latest Struts 1.1b2 and I am trying to get the > validator working. I did drop the struts validator war into Weblogic and it > validates fine. > > In my test, I did my own ValidatorTestForm which extends ValidatorForm and > implements Serializable and it does not contain a validate method. It > contains two string fields name and number. > In the Struts config file I have added the plug-in: > <plug-in className="org.apache.struts.validator.ValidatorPlugIn"> > <set-property property="pathname" > value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/> > </plug-in> > > In my validation.xml file I have put > <form name="validatorTestForm"> > <field property="name" depends="required"> > <arg0 key="validatorTestForm.name"/> > </field> > <field property="number" depends="required"> > <arg0 key="validatorTestForm.number"/> > </field> > </form> > > In this simple test I have testValidator.jsp that has the name and number > fields on it. Its form's target is validatorTest.do which looks like this: > <action path="/validatorTest" > type="com.companyname.project.web.test.ValidatorTestAction" > name="validatorTestForm" > validate="true" > scope="request"> > > <forward name="success" path="/test/validatorTestResults.jsp"/> > <forward name="error" path="/error.jsp"/> > </action> > > I go to this JSP page but instead of entering anything in for name and > number I just press submit (I want to test the required condition). I can > set a breakpoint in the Struts file ValidatorForm in its validate method but > the validatorResults always comes back with a count of zero and nothing ever > gets stuck into ActionErrors. > > Can anyone please tell me what I am missing? > > Many Thanks! > Erich Kilmer > > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

