> Check out how to make a Controller using formproc
> http://sourceforge.net/projects/formproc/
Make your own controller ie. AbstractValidationController that runs code
like this:
log.info("AbstractValidationController.validate() started.");
try {
this.getContext().getParams().remove("form");
if (this.form != null) {
FormManager fm = new FormManager();
HttpForm form = new HttpForm(this.form, null);
fm.configure(form);
log.debug("Validating form.");
this.validationResults = form.process(this.getRequest());
if (!this.validationResults.isValid()) {
log.debug("Form validation failed. Returning to input.");
log.info("AbstractValidationController.validate() ended.");
return INPUT;
}
log.debug("Form validated successfully. Continuing execution.");
} else {
log.debug("Skipping validation. No \"form\" controller parameter was
specified. Continuing execution.");
}
} catch (Exception e) {
log.info("AbstractValidationController.validate() failed.");
throw e;
}
log.info("AbstractValidationController.validate() ended.");
Then just put parameters to controller that denote the name of the form.
In this case the parametrer is "form". Then just extend that controller
whenever you need automatic validation via formproc.
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
[INVALID FOOTER]