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]

Reply via email to