struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yves Sy <yves...@gmail.com>
Subject Re: Action Class Reusable
Date Wed, 01 Sep 2004 13:11:48 GMT
Hi,

Some action classes can be made reusable, such as actions that add
attachments. You have to try to make your code as generic as possible
in these actions and simply define a different path in the forward of
the corresponding ActionMapping.

But these are generally rare cases. Often times, its advisable to
create an Action class for each "transaction" you can do from a page
(such as clicking links and buttons). This design makes Action classes
easier to maintain. Having one action class handle everything in a
module can make things very complicated.

Grouping similar transactions such as CRUD actions on a certain module
is a different thing. For that you can use DispatchAction. It is up to
the developer to figure out which transactions can be logically be
grouped together using DispatchAction and which should be separated in
plain old Actions.

Finally, business logic should never be coupled with your Action
classes. Your action classes should simply do some synctactic
validation (if your not using validate() in the ActionForm or
DynaValidatorForms) and point execution to the right direction and not
much else.

-Yves-

On Wed, 1 Sep 2004 18:13:08 +0530, Jitesh Sinha <jsinha@cisco.com> wrote:
> Hi All,
> 
> Is there a way we can make our Action Classes reusable across different
> modules?
> Generally we have one Action class for every module.Maybe,if we put our
> business logic in different business classes (particular to a module) and
> make these business classes implement a common interface?
> I have only a vague idea till now about this.Can someone elaborate?
> 
> Thanks,
> -Jitesh
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


-- 
For me to poop on!
http://www.formetopoopon.com
http://www.nbc.com/nbc/Late_Night_with_Conan_O'Brien/video/triumph.shtml

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message