Hi,

I personally :

1] Do NOT use inheritance, besides ActionSupport that provides the basic
methods (getText, ..) to work with Struts2.

2] Group all methods of a form inside the same Action. Usually, I need
the same code to prepare the input and the validation of the form, so
why would I bother with inheritance and additional classes when I can
find two clean methods in the same class ?

3] Never ever put business logic (besides validation, that should belong
to the domain, but Struts2 doesn't provide any adapter for Hibernate
Validator, so I have to live with that for now) inside the Actions. The
Actions are just here to either query services/domain or create business
objects and save them.  (See Domain Driven Design recommendations for
more information)

4] I only implement SessioNAware, ValidationAware, and so on when I need
to. I do not want to clutter ALL my classes with useless stuff I only
use 10% of the time. Just KISS :)

Regards,
Sami Dalouche

On Mon, 2007-06-11 at 05:52 -0700, meeboo wrote:
> Hey all
> 
> How do you build up your Struts 2 applications architecture wise? Say for
> instance that you have a User model object. Do you create an action class
> (e.g. UserAction.java) for all User actions, or do you separate them into
> UpdateUser.java/CreateUser.java etc...? We thought Struts 2 was a big mess
> at first since it allows you to construct your web-tier in virtually any way
> you want. But after a couple of weeks we started using a "pattern" where
> each JSP page has its own java action class and all action classes inherit
> from a superclass which implements SessionAware, ValidationAware and so
> forth. Do you think this is a good approach? It's worked great for us so
> far. 
> 
> Cheers!


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

Reply via email to