At 1:44 PM +0800 8/27/04, Yves Sy wrote:
When you use DynaValidatorForm, you don't really have a choice other
than to use the Validator framework as you cannot override the
validate() method. You can only override when you write your own
ActionForm.

Well, you can certainly subclass a ValidatorForm and do your own validation plus a call to super.validate(...).


Regarding the original question: neither is "better". The Validator framework provides easy configurable validation for common validations, and it provides a way (although one I find confusing) to add your own configurable validations. It also is designed to provide fairly automatic client-side javascript validation in coordination with the <html:javascript> tag.

I would suggest that you start by trying to use the validator framework, and more specifically, the DynaValidatorForm and DynaValidatorActionForm. It allows you to deal with the majority of forms without writing any supporting java code, either for carrying the values from the HttpServletRequest into Struts or for validation.

If you find it doesn't do everything you need, you can either write a pluggable validator, subclass the ValidatorForm (or DynaValidatorForm) or write your own subclass of ActionForm.

Hope this helps
        Joe

--
Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "In fact, when I die, if I don't hear 'A Love Supreme,' I'll turn back; I'll know I'm in the wrong place."
- Carlos Santana

Reply via email to