u need to have failure return path in the <action /> tag.
like 

<forward name="Failure" path="/pages/layouts/page1.jsp" redirect="false"/>

so when there is a error it will be forwarded to page1.jsp

-yoga
-----Original Message-----
From: Rajat Pandit [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 04, 2003 11:40 AM
To: [EMAIL PROTECTED]
Subject: validation not working


hello all,
i have a form, which inputs a number of units. the problem is that in 
case of a validation error. the page does not return back to the form. 
and just stops.
the following are the extract of my validation method and 
struts-config.xml file.

if anyone could point out somethng i am missing. i am now closing to 
banging my head on the desk now!!.

<!-- struts file -->

         <action path="/updateProduct"
                 type="com.hedging.admin.productmanagement.updateProduct"
                 name="addStateForm"
                 validate="true"
                 scope="request"
                 input="/pages/layouts/updateProductForm.jsp">
             <set-property property="loginRequired" value="true" />
             <forward name="showForm" 
path="/pages/layouts/updateProductForm.jsp" />
         </action>
<!-- struts file -->


<!--validation method -->
    public ActionErrors validate (ActionMapping mapping,
                                  HttpServletRequest request) {
        ActionErrors errors = new ActionErrors();
         if ((this.getNoOfStates() < 0) || (this.getNoOfStates() > 100))
            System.err.println("---> Error occured!!!");
            errors.add("noOfStates",
                        new ActionError("errors.toManyStates"));
        }
        return errors;
    }

<!-- end of validation method -->

-- 


Rajat Pandit | [EMAIL PROTECTED]
+91 612 3117606
[ Developer and Part Time Human Being]



---------------------------------------------------------------------
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]

Reply via email to