You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mohan Radhakrishnan <Mo...@hclcomnet.co.in> on 2002/12/02 07:21:27 UTC

subclassing action

Hi,
      I am looking for information on subclassing actions. Is there a way to
transfer control to the subclass if a certain check in the super action is
valid ?
Is this how this is done ? In normal OO, it happens based on polymorphism.
How is it done with struts ?

Thanks,
Mohan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: subclassing action

Posted by "V. Cekvenich" <vi...@users.sourceforge.net>.
same

Mohan Radhakrishnan wrote:
> Hi,
>       I am looking for information on subclassing actions. Is there a way to
> transfer control to the subclass if a certain check in the super action is
> valid ?
> Is this how this is done ? In normal OO, it happens based on polymorphism.
> How is it done with struts ?
> 
> Thanks,
> Mohan




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: subclassing action

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Mon, 2 Dec 2002, Mohan Radhakrishnan wrote:

> Date: Mon, 2 Dec 2002 11:51:27 +0530
> From: Mohan Radhakrishnan <Mo...@hclcomnet.co.in>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: struts-user@jakarta.apache.org
> Subject: subclassing action
>
> Hi,
>       I am looking for information on subclassing actions. Is there a way to
> transfer control to the subclass if a certain check in the super action is
> valid ?
> Is this how this is done ? In normal OO, it happens based on polymorphism.
> How is it done with struts ?
>

A common technique in Struts based apps is to have a common base Action
that embeds functionality common to a set of your application's
requirements, such as customized login checking.  The general pattern
would be to have the common base class implement the public execute()
method (in 1.0 it was perform()), and then dispatch to business logic in
some other (usually protected) methods defined by the base class.

You can also do things like dynamically choose which business logic method
to call, based on request parameters.  This use case is so common that
Struts provides a standard base class
(org.apache.struts.actions.DispatchAction) for you.

> Thanks,
> Mohan

Craig


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>