Let me repaste what I think might be relevant for you to take a look at it:
DynaActionForm code: [ Note: This is extending DynaValidatorForm ] ----------------------------------- public class StudentEnquiryDynaActionForm extends DynaValidatorForm { public ActionErrors validate(ActionMapping actionMapping, ServletRequest servletRequest) { System.out.println("**********************************In the validation!**********************"); return errors; } } -------------------------------------- struts-config.xml: <form-bean name="studentEnquiryForm" type=" com.tuningfork.student.formobject.StudentEnquiryDynaActionForm"> <form-property name="studentEnquiry" type=" com.tuningfork.student.businessobject.enquiry.StudentEnquiry "/> <form-property name="contactAddress" type=" com.tuningfork.student.businessobject.enquiry.StudentAddress"/> </form-bean> <action attribute="studentEnquiryForm" name="studentEnquiryForm" path="/StudentEnquiryPre" scope="request" validate="false" type=" com.tuningfork.student.action.StudentEnquiryAction " parameter="operation"> <forward name="preCreateSuccess" path="/student/StudentEnquiry.jsp"/> <forward name="preUpdateSuccess" path="/student/StudentEnquiry.jsp"/> <forward name="viewSuccess" path="/student/StudentEnquiry.jsp"/> </action> <action attribute="studentEnquiryForm" name="studentEnquiryForm" path="/StudentEnquiry" scope="request" validate="true" type=" com.tuningfork.student.action.StudentEnquiryAction " parameter="operation" input="/StudentEnquiryPre.do?operation=validateFailed"> <forward name="preCreateSuccess" path="/student/StudentEnquiry.jsp"/> <forward name="viewSuccess" path="/student/StudentEnquiry.jsp"/> <forward name="createSuccess" path="/student/EntryConfirmation.jsp"/> <forward name="updateSuccess" path="/student/EntryConfirmation.jsp"/> <forward name="createAndEnrollSuccess" path="/StudentEnrollmentPre.do?operation=preCreate" redirect="true"/> </action> --------------------------------------- Yes, I set validate = true. I also have a set of mappings where validate=false. What I can say for sure is that validations are kicking in .... the validation.xml validations are all happening fine. The problem is that my validate function of the action form is not being called (i.e. I cant see the string "********In the validation!**********" on my console. And regarding validating manually, I shall keep it in mind for my next application. Would not want to disturb something that is (or may be was) working right now... :-) ~raghu ps: Your new website looks quite good. :-) Hope to see even more articles than we had on strutting site. On 1/20/06, Rick Reumann <[EMAIL PROTECTED]> wrote: > > What does your action mapping look like? Do you have validate=true set for > the form? > > Mind you, I'm not a fan of using automatic validation:) I prefer to call > validate manually from my Action class. I explain my reasons here > http://www.learntechnology.net/validate-manually.do > > > > On 1/20/06, Raghu Kanchustambham <[EMAIL PROTECTED]> wrote: > > > > Thanks Rick for the response. > > My first issue Rick is that my validate function in the form is not > > getting > > called at all. > > I have simply put a "System.out.println" statement there to verify that > it > > is getting called. > > > > What you have given is definitely useful for me in the second step :-) > But > > I > > need to get the first step correct... that is to make sure my validate > > function is being called in addition to validation.xml rules. > > > > Could you help me with that? > > > > Thanks. > > Raghu > > > > > > > > On 1/20/06, Rick Reumann <[EMAIL PROTECTED]> wrote: > > > > > > Raghu Kanchustambham wrote the following on 1/20/2006 9:22 AM: > > > > Hi, > > > > When I want to retain validation.xml for validation of most of my > > fields > > > on > > > > the form. However, the rules for one particular field is too complex > > to > > > be > > > > done with just the validation.xml. I intend to check for it in the > > > > validation form action. What I see is that the action form's > validate > > > > function is not getting called. > > > > > > Here's how I've done it in the past. There might be a better way: > > > > > > //in form Validate method... > > > > > > ServletContext application = getServlet().getServletContext(); > > > > > > ActionErrors errors = new ActionErrors(); > > > > > > String parameter = request.getParameter( mapping.getParameter() ); > > > > > > Validator validator = Resources.initValidator( parameter, this, > > > application, request, errors, page); > > > > > > try { > > > validatorResults = validator.validate(); > > > } catch (ValidatorException e) { > > > log.error(e.getMessage(), e); > > > } > > > > > > //now do you manual validation say on age > > > String prop = request.getParameter("prop"); > > > if ( //some test on prop) { > > > errors.add(ActionMessages.GLOBAL_MESSAGE, new > > > ActionError("errors.something", "Prop")); > > > } > > > > > > return errors; > > > > > > -- > > > Rick > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > -- > Rick > >