Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

When is validate called on a DynaValidatorForm?

 
Brett Han
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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().
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic