The moose likes Struts and the fly likes When is validate called on a DynaValidatorForm? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "When is validate called on a DynaValidatorForm?" Watch "When is validate called on a DynaValidatorForm?" New topic

When is validate called on a DynaValidatorForm?

Brett Han

Joined: May 17, 2005
Posts: 10
Probably a another dumb newbie question, but I can't get validate to be called on my subclass of DynaValidatorForm. I have a subclass of ValidatorForm with the exact same setup (replacing the corresponding Action and Form class names) in struts_config.xml - yes, both have validate="true", and this works fine. But the validate() method is never called when I submit the form which extends DynaValidatorForm.

I know the question might be a little vague, and I'm not even 100% sure that it's the fact that I'm using a DynaValidatorForm that's causing the problem (could be some configuration issue elsewhere), but any suggestions?

In general, when exactly is validate called on the Form object by the Action Servlet?

Thanks in advance.
Marc Peabody
pie sneak

Joined: Feb 05, 2003
Posts: 4727

It occurs after the request parameters are set in the ActionForm and right before the Action is called. If validation is set to true and validation fails, the Action class is never called.

The validate method is getting called. Something else must be the problem. If you are expecting it to trigger the validation framework, it is possible that you overrode the validate method without calling super.validate().

A good workman is known by his tools.
I agree. Here's the link:
subject: When is validate called on a DynaValidatorForm?
It's not a secret anymore!