On 30/03/2004 21:02, "Joao Batistella" <[EMAIL PROTECTED]>
wrote:

> That's right.
> But I have a problem. I have a superclass that all other actions extend and
> this class only implement execute method with generic validations and so on.
> So, I need the execute method being called, understand?
> 

  Sorry... 

  You can also could put the generic validations implemented on a abstract
class BaseActionUtils with public/protected static methods (any good IDE has
refactoring capabilities that do this in a blink of an eye).

  This way your superclass does its work by calling the
BaseActionUtils.genericValidation(mapping, form, etc) and you can still use
dispatch action abilities.

  method add() {

    BaseActionUtils.genericValidation(...);
    
  }

  There is nothing more simpler that I can remember.

  This way you have the assurance that if you extend the base everything is
like it's supposed to and if you don't extend then it is your job to assure
that the generic validation is done first (call explicitly the
genericValidation method).

  Better yet, even if later on you want to change how generic validation
works, you have the assurance by changing BaseActionUtils, you change
generic validation on all action classes (just like simply extending the
base class).

Pedro Salgado

> Thanks.
> 
> -----Original Message-----
> From: Prabhat Kumar (IT) [mailto:[EMAIL PROTECTED]
> Sent: terça-feira, 30 de março de 2004 17:33
> To: Struts Users Mailing List
> Subject: RE: One Action class but more than one functionality
> 
> 
> look at the org.apache.struts.actions.DispatchAction class. It is exactly
> for the use case you described.
> 
> -----Original Message-----
> From: Joao Batistella [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 30, 2004 11:28 AM
> To: 'Struts Users Mailing List'
> Subject: One Action class but more than one functionality
> 
> 
> Hello.
> 
> I have an action class to create, edit and remove a Person, for example.
> Is this a poor decision? I mean, should I create 3 action classes, one for
> create, another for edit and another one for remove?
> 
> Does struts have a mechanism to help me in that?
> 
> Thanks all.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


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

Reply via email to