-----Original Message----- From: Mailing List Sent: Tuesday, June 22, 2004 1:47 PM To: 'Struts Users Mailing List' Subject: RE: I Wondor Why Validation Doesn't Validate
Dear Friends Thank you very much for your attention; I checked both 'validate="true" ' and also 'empty spaces', they didn't solve the problem. Actually the part of 'if (!errors.isEmpty())' returns false all the time(see below, section 4). My previous project is already working properly with 'validate="false"', but this one.... :( Again any help would be appreciated Thank you Nafise -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, June 21, 2004 5:51 PM To: Struts Users Mailing List Subject: Re: I Wondor Why Validation Doesn't Validate Nafise said: > I did the follow steps for setting validation, but there is no error on an > empty field checking 'chequeNumber' (see below plz). > > > 1. Placing the validation.xml & validator-rules.xml in WEB-INF folder > 2. In struts-config.xml : > a. <plug-in className="org.apache.struts.validator.ValidatorPlugIn"> > <set-property > property="pathnames" > value="/WEB-INF/struts/validator-rules.xml, > /WEB-INF/struts/validation.xml" /> > </plug-in> > > b. <form-bean name="CreditStudentForm" > type="org.apache.struts.validator.DynaValidatorForm"> > > <form-property name="chequeNumber" type="java.lang.String"/> > <form-property name="studentId" type="java.lang.Integer" /> > <form-property name="dispatch" type="java.lang.String" /> > > > </form-bean> > > c. <action path="/creditStudent" parameter="dispatch" > type="com.pdpsoft.lms.struts.action.CreditStudentAction" > name="CreditStudentForm" validate="false" scope="session"/> I am aware that it is not what you want, but what happens if you set validate="true"? > 3. In validation.xml : > > <form name=" CreditStudentForm "> > <field > property=" chequeNumber " > depends="required"> > </field> > </form> Could the spaces in <form name> and <field property" be a problem ? > 4. In Action: > > ActionErrors errors = dynaForm.validate(mapping, request); > if (!errors.isEmpty()) { //this if is never true :( > saveErrors(request, errors); > return mapping.findForward("aForward"); > } > 5. In jsp: > > <html:errors/> Best regards Claus Nielsen --------------------------------------------------------------------- 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]