Leandro Melo wrote:
Frank, as i said, i only want to call another method
everytime validate() fails. That's the only thing i
wanna do.

If i only overwritte ActionForm and create a
MyBaseActionForm, in my specific forms i'd have to do
something like this inside validate() method.

if (errors != null){
  mySpecificMethod();
}

What will cause me to modify all action forms i got.
I thought i'd be simpler if i just overwritte the
request processor and put the above code inside it.

What do you thing now? Is still not the better idea?

I ask because i'm really a beginner, so i don't know
if it would be the best architecture.

This is another reason why I still think calling validate() manually from your Action is a much better approach then relying on Struts do it for you. If you call form.validate() from your Action you then have control over what you want to do. So in your Action you could do...


//in your Action execute or dispatch method:

ActionErrors errors = myForm.validate();
if ( errors != null ) {
   mySpecificMethod();
   return( mapping.findFoward("SUCCESS");
} else {
   saveErrors(request, errors);
   return( mapping.findFoward("SUCCESS");
}

Another option is that you can still have your forms over-ride a base ActionForm and then at the end of the validate method, if you get errors, you can then call super.validate() which will call your mySpecificMethod(); of your Super class.

--
Rick

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to