Martin Ravell wrote: > So you call validate from within the Action? > Yes. > Do you then have to forward back to the original page if you have errors? > Yes.
One nice thing about doing validation "manually" (see below) is that I can add further validation that would be irritating to do in validation.xml (say by writing a custom validator) or validation that requires trips to the DB, etc. I really only use validation.xml for the easy stuff, mostly just the stuff that comes with it, with an occasional custom validator. > Have you tried having validate="true" in your action? > Yes, but that can cause issues, like if your input form needs setup before display, etc. > Could I take a look at an example out of one of your Actions? > No, but I've appended some pseudo-code, although it might not help. > Thanks for showing me that the input can point to a tiles definition. I've > been trying this without luck. Perhaps I have something in my configuration > somewhere which is not setup 100% correctly. > I'm not sure where it could get messed up; it's pretty straight-forward. So, here's (very) psuedo-code for one version of an Action class hierarchy. Basically all I'd do in my subclasses is implement something in executePost. Currently I'm not even doing much there, it's just marshalling stuff from the form into a bean and calling stuff on the business and ORM side of things. There was a pretty good thread some time ago with Frank Zammetti regarding ways to never have to change your code inside of your action classes through various means that is probably worth looking up if you're interested in such things. ========== BASE ACTION CLASS ========== // Call subclass or default impls public ActionForward execute(...) { if (!prepForAction()) handleError(); return executeGet() if isGetRequest(); return getInputForward() if validationErrors(); return executePost(); } // Default impl goes to input page public executeGet() { return getInputForward(); } // Default impl calls form's validation method and does the right thing public validationErrors() { errs = form.validate(); if (haveErrs) saveErrors(); } ========== SUBCLASS EXAMPLE ========== public prepForAction() { request.setAttribute("listOfSomething", getListOfSomething()); } public executePost() { // Do stuff relating to form post } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]