You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Burton Rhodes <bu...@gmail.com> on 2009/02/24 14:42:50 UTC

Struts 2 Architecture - Best Practices...

I am curious to know what structure many of you use to organize and
separate your struts apps.  I can't seem to find a "standard" in this
regard.  I started with a simple application, and of course, it has
grown to where more separation of logic layers is a must.  Right now I
have Presentation Layer (jsp & action classes) and a data layer (DAO &
DAO Implementation classes).  I am upgrading this application to use
Struts 2, Spring, JPA, & Hibernate.  Right now many of my action
classes directly use my dao classes with some exceptions where the
logic was complicated.  Is it the general consensus that there should
be NO access to DAO in the Action classes?  If so, it seems like this
could create quite a few "Service Layer" classes (perhaps I'm wrong on
this).  I know there is no :correct: answer, but would love to hear
from the experts as to what you do in this regard.

Also, would love to know any naming conventions or class organization
structure you use (e.g. com.[company].action.*,.
com.[company].service.*,. com.[company].entity.*,.
com.[company].doa.*, etc) .

Many thanks!

Burton

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


Re: Struts 2 Architecture - Best Practices...

Posted by Lukasz Lenart <lu...@googlemail.com>.
2009/2/24 Burton Rhodes <bu...@gmail.com>:
> Also, would love to know any naming conventions or class organization
> structure you use (e.g. com.[company].action.*,.
> com.[company].service.*,. com.[company].entity.*,.
> com.[company].doa.*, etc) .

Maybe it will be better something like this:

com.<company>.<product>.model || domain
com.<company>.<product>.services
com.<company>.<product>.web
com.<company>.<product>.web.actions
com.<company>.<product>.web.inteceptors
com.<company>.<product>.web.validators
etc.


Regards
-- 
Lukasz
http://www.lenart.org.pl/

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


RE: Struts 2 Architecture - Best Practices...

Posted by Mileidys Gonzalez Prieto <mi...@i-frontier.net>.
Hi, some days ago I was also worry about how big is my Struts+Hibernate
project, and a plus... need to grow much more... then, I started to look for
solutions on the web. 
I'm using MyEclipse, and it provides a enterprise application that really
looks interesting, I just started to read about that, then I don’t have a
lot to say, but looks like u can divide your large application is small one,
everything related by an EAR project, by default in the way:
EAR Project + EJB Project (Hibernate I think can be there) + Web Project
(Struts can be here)

Hope the idea will help...


Mileidys González Prieto
Consultant
i-Frontier
 
Henck Arronstraat 16 | P.O.Box 12858 | Paramaribo, Suriname (SA)
Office: (597)-424073 | Mobile: (597)-8810219
www.i-frontier.net


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


RE: Struts 2 Architecture - Best Practices...

Posted by Andy <an...@hotmail.com>.
I am a big hibernate fan, but for my needs I might not need such a big tool to accomplish my goals.  I like the Spring JdbcTemplate for data mapping and data access techniques because its simple and I control the SQL.  The downsides are I dont get automatic dialect and all the other cool features of hibernate, but thats ok because I dont need them.  By using a separate DAO and Service layer I could somewhat easily swap out Hibernate for Spring JdbcTemplate in my DAOs and thus not affect any of my application flow logic since the Service API remains unchanged.

 


 
> Date: Tue, 24 Feb 2009 14:56:30 -0600
> Subject: Re: Struts 2 Architecture - Best Practices...
> From: burtonrhodes@gmail.com
> To: user@struts.apache.org
> 
> Thank you for the replies. That is very helpful. Sounds like I will
> remove all dao into service layer.
> 
> (Off topic:)
> Why might you switch back to jdbc as opposed to hibernate. What
> obstacles are you facing there?
> 
> On 2/24/09, Andy <an...@hotmail.com> wrote:
> >
> > Right now I am using Struts2, Spring, and Hibernate. Although the Spring
> > JdbcTemplate is looking better all the time.
> >
> >
> >
> > I follow this: Action --> Service --> Dao
> >
> >
> >
> > Yes it is more code, but the benefits are in testibility, componentization,
> > and maintenance.
> >
> >
> >
> > I even have this: Action --> Service --> JSP so that I can wrap my
> > business objects instead of adding formatting functionality, etc directly to
> > my nice b.o. pojos.
> >
> >
> >
> > That's just how I do it.
> >
> >
> >
> >> Date: Tue, 24 Feb 2009 07:42:50 -0600
> >> Subject: Struts 2 Architecture - Best Practices...
> >> From: burtonrhodes@gmail.com
> >> To: user@struts.apache.org
> >>
> >> I am curious to know what structure many of you use to organize and
> >> separate your struts apps. I can't seem to find a "standard" in this
> >> regard. I started with a simple application, and of course, it has
> >> grown to where more separation of logic layers is a must. Right now I
> >> have Presentation Layer (jsp & action classes) and a data layer (DAO &
> >> DAO Implementation classes). I am upgrading this application to use
> >> Struts 2, Spring, JPA, & Hibernate. Right now many of my action
> >> classes directly use my dao classes with some exceptions where the
> >> logic was complicated. Is it the general consensus that there should
> >> be NO access to DAO in the Action classes? If so, it seems like this
> >> could create quite a few "Service Layer" classes (perhaps I'm wrong on
> >> this). I know there is no :correct: answer, but would love to hear
> >> from the experts as to what you do in this regard.
> >>
> >> Also, would love to know any naming conventions or class organization
> >> structure you use (e.g. com.[company].action.*,.
> >> com.[company].service.*,. com.[company].entity.*,.
> >> com.[company].doa.*, etc) .
> >>
> >> Many thanks!
> >>
> >> Burton
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >
> > _________________________________________________________________
> > Access your email online and on the go with Windows Live Hotmail.
> > http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_HM_AE_Access_022009
> 
> -- 
> Sent from my mobile device
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 

_________________________________________________________________
Windows Live™ Hotmail®:…more than just e-mail. 
http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t2_hm_justgotbetter_explore_022009

Re: Struts 2 Architecture - Best Practices...

Posted by Burton Rhodes <bu...@gmail.com>.
Thank you for the replies. That is very helpful.  Sounds like I will
remove all dao into service layer.

(Off topic:)
Why might you switch back to jdbc as opposed to hibernate. What
obstacles are you facing there?

On 2/24/09, Andy <an...@hotmail.com> wrote:
>
> Right now I am using Struts2, Spring, and Hibernate.  Although the Spring
> JdbcTemplate is looking better all the time.
>
>
>
> I follow this:  Action --> Service --> Dao
>
>
>
> Yes it is more code, but the benefits are in testibility, componentization,
> and maintenance.
>
>
>
> I even have this:  Action --> Service --> JSP    so that I can wrap my
> business objects instead of adding formatting functionality, etc directly to
> my nice b.o. pojos.
>
>
>
> That's just how I do it.
>
>
>
>> Date: Tue, 24 Feb 2009 07:42:50 -0600
>> Subject: Struts 2 Architecture - Best Practices...
>> From: burtonrhodes@gmail.com
>> To: user@struts.apache.org
>>
>> I am curious to know what structure many of you use to organize and
>> separate your struts apps. I can't seem to find a "standard" in this
>> regard. I started with a simple application, and of course, it has
>> grown to where more separation of logic layers is a must. Right now I
>> have Presentation Layer (jsp & action classes) and a data layer (DAO &
>> DAO Implementation classes). I am upgrading this application to use
>> Struts 2, Spring, JPA, & Hibernate. Right now many of my action
>> classes directly use my dao classes with some exceptions where the
>> logic was complicated. Is it the general consensus that there should
>> be NO access to DAO in the Action classes? If so, it seems like this
>> could create quite a few "Service Layer" classes (perhaps I'm wrong on
>> this). I know there is no :correct: answer, but would love to hear
>> from the experts as to what you do in this regard.
>>
>> Also, would love to know any naming conventions or class organization
>> structure you use (e.g. com.[company].action.*,.
>> com.[company].service.*,. com.[company].entity.*,.
>> com.[company].doa.*, etc) .
>>
>> Many thanks!
>>
>> Burton
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>
> _________________________________________________________________
> Access your email online and on the go with Windows Live Hotmail.
> http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_HM_AE_Access_022009

-- 
Sent from my mobile device

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


RE: Struts 2 Architecture - Best Practices...

Posted by Andy <an...@hotmail.com>.
Right now I am using Struts2, Spring, and Hibernate.  Although the Spring JdbcTemplate is looking better all the time.

 

I follow this:  Action --> Service --> Dao

 

Yes it is more code, but the benefits are in testibility, componentization, and maintenance.

 

I even have this:  Action --> Service --> JSP    so that I can wrap my business objects instead of adding formatting functionality, etc directly to my nice b.o. pojos.

 

That's just how I do it.


 
> Date: Tue, 24 Feb 2009 07:42:50 -0600
> Subject: Struts 2 Architecture - Best Practices...
> From: burtonrhodes@gmail.com
> To: user@struts.apache.org
> 
> I am curious to know what structure many of you use to organize and
> separate your struts apps. I can't seem to find a "standard" in this
> regard. I started with a simple application, and of course, it has
> grown to where more separation of logic layers is a must. Right now I
> have Presentation Layer (jsp & action classes) and a data layer (DAO &
> DAO Implementation classes). I am upgrading this application to use
> Struts 2, Spring, JPA, & Hibernate. Right now many of my action
> classes directly use my dao classes with some exceptions where the
> logic was complicated. Is it the general consensus that there should
> be NO access to DAO in the Action classes? If so, it seems like this
> could create quite a few "Service Layer" classes (perhaps I'm wrong on
> this). I know there is no :correct: answer, but would love to hear
> from the experts as to what you do in this regard.
> 
> Also, would love to know any naming conventions or class organization
> structure you use (e.g. com.[company].action.*,.
> com.[company].service.*,. com.[company].entity.*,.
> com.[company].doa.*, etc) .
> 
> Many thanks!
> 
> Burton
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 

_________________________________________________________________
Access your email online and on the go with Windows Live Hotmail.
http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_HM_AE_Access_022009