You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by UseTheFork <jv...@gmail.com> on 2008/09/15 15:12:20 UTC
Struts versus Spring newbie question
Hi,
I am exploring the different frameworks used in J2EE. I start to understand
the Struts concepts and managed to make examples run on my PC. I am now
exploring Spring.
It seems like Struts and Spring are incompatible. I mean, one has to choose
either the Spring OR the Struts framework to implement a J2EE application,
but not both at the same time.
Can someone with more experience than me confirm this?
Thanks,
J.
--
View this message in context: http://www.nabble.com/Struts-versus-Spring-newbie-question-tp19492685p19492685.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Struts versus Spring newbie question
Posted by Alberto Flores <af...@umd.edu>.
These two frameworks are not mutually exclusive and would need to
understand from what point of view are you learning it.
Struts is mostly an implementation of the MVC architectural design
pattern. Spring is a framework that makes J2EE development simpler.
Among many other things, part of Spring is to provide an MVC
implementation (Spring MVC is a competitor to Struts) but that's simply
a very small subset of what Spring does.
Additionally, if you are comparing Struts 1.x to Spring MVC, you'll find
substantial differences that will (hopefully) make you see the beauty of
Spring MVC. If you are comparing Struts 2.x with Spring MVC then the
differences are not going to be that drastic, however is a choice you'll
have to make as both of them are similar (of course there are subtle
differences that are worth learning down the road such as implementation
of servlets vs filters, interceptors vs AOP, etc). Personal, I've found
using Struts2 a delight.
In a J2EE application there's much more than just MVC so you may need to
be careful in what other areas you are looking at (e.g. database
connectivity and connection pooling, transaction management, messaging,
integration with legacy systems, clustering, web-services, etc). These
are not covered in Struts at all. It is in these areas where Spring can
help tremendously. You can also write to these traditional concepts in
J2EE using technologies such as JAXB, JWS, JDBC (JTA) or any other
technology, but that choice is yours. With the upcoming releases in JEE,
the differences between Spring and JEE technologies are reducing (still
are plenty).
Hope this helps!
UseTheFork wrote:
> Hi,
>
> I am exploring the different frameworks used in J2EE. I start to understand
> the Struts concepts and managed to make examples run on my PC. I am now
> exploring Spring.
>
> It seems like Struts and Spring are incompatible. I mean, one has to choose
> either the Spring OR the Struts framework to implement a J2EE application,
> but not both at the same time.
>
> Can someone with more experience than me confirm this?
>
> Thanks,
>
> J.
--
--
Alberto
http://www.linkedin.com/in/aflores
Re: Struts versus Spring newbie question
Posted by UseTheFork <jv...@gmail.com>.
Hi Alberto,
Many thanks for this clarification !!! It really helps !!! I have other
questions, but on another subject. I will post another message at the right
place on Nabble !!!
Thanks again,
J.
--
View this message in context: http://www.nabble.com/Struts-versus-Spring-newbie-question-tp19492685p19496044.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Struts versus Spring newbie question
Posted by Alberto Flores <af...@umd.edu>.
> a) From a MVC perspective: Struts and Spring are incompatible. However, if I
> ignore the MVC
> part of Spring, Struts and Spring are perfectly compatible.
Yes! , although you could have Struts and Spring in the same app (I
suppose, but as someone pointed out, that would probably be silly).
> b) Still from a MVC perspective: Spring MVC is better then Struts 1.x, but
> there are no significant
> differences between Spring MVC and Struts 2.x.
>
This will depend on the problem you are trying to solve. The one
argument I would probably say is that you could benefit a lot from
Spring WebFlow which is not supported on Struts 2.x (and mixes well with
Spring MVC). I spoke with Keith Donald from Spring and apparently
there's not enough interest in the Spring community to support WebFlow
in Struts 2.x (yet). As a way of reference, web flow is a component
from Spring that allows you to do long conversations (e.g. shopping cart
applications where things are maintained during a "session"). I would
probably choose Spring MVC if this was a requirement.
> c) Spring is interesting, because it provides J2EE facilities not covered by
> Struts. That is
> why you would want to combine both technologies.
>
Among others, yes!
> I have two more questions:
>
> i) If I have to implement a project using Struts 2.x, would you recommend
> using the Struts MVC
> or the Spring MVC?
>
This will depend on your requirements (see above). I have been using
Struts 2.x just fine and it has been scaling rather well. I'm sure
you'll find a lot of people liking Spring MVC even more. Spring MVC,
IMHO is a much better framework when combined with Spring WebFlow (not
to mention that the Spring IDE helps a lot on these.
> ii) Is it really worth learning/using the Spring framework in a J2EE project
> (not matter if it
> is with Struts MVC or Spring MVC) or is it better to create your own code to
> access the
> J2EE technologies not covered by Struts?
One thing I like about Spring is that you don't need to use it all at
once. You can write pieces that uses Spring here and there and then
start refactoring progressively. For example, try writing code for
messaging (JMS) and then try the same code using Spring and see for
yourself. Similarly, simply try plain JDBC code and later try using the
JDBCDaoSupport and see for yourself.
Additionally, I don't think you should forget J2EE technologies just
because you know Spring well. There may be an environment where you can
not simply use Spring and knowing how things work under the hood will
come in handy. Use spring as your friend (and tentatively as your
framework of choice). You still need to know what the J2EE technologies
are doing under the hood and learn what Spring does on top of them. In
some cases, these represent a thin layer on top of J2EE, in others, it
encourages a different design.
Hope this helps!
--
--
Alberto
http://www.linkedin.com/in/aflores
Re: Struts versus Spring newbie question
Posted by Alberto Flores <af...@umd.edu>.
I agree... One needs to know (or at least understand the basics)
Frank W. Zammetti wrote:
> Dave Newton wrote:
>>> ii) Is it really worth learning/using the Spring framework
>>> in a J2EE project (not matter if it is with Struts MVC or Spring MVC)
>>> or is it better to create your own code to access the J2EE
>>> technologies not covered by Struts?
>>>
>>
>> Unless you have tens of thousands of available man-hours then Spring
>> is worth learning. It does, however, depend on what your project's
>> needs are. There are lighter-weight DI/IoC containers--if that's all
>> you're using it for then perhaps it doesn't matter. It has several
>> other aspects (pun!) though.
>>
>>
> Woah... I know a lot of people don't like J2EE these days, but does it
> really take "tens of thousands of available man-hours" to "create your
> own code to access the J2EE technologies not covered by Struts"? I
> mean, JDBC isn't *technically* covered by Struts, and last I checked it
> doesn't take more than a few minutes (at MOST) to hack together JDBC
> code... likewise, while I'm about a far from a fan of EJB as you can
> get, is it really *that* bad?
>
> While I'm all for Spring, I don't think anyone should be scared to NOT
> use it, but this sure makes it sound like I should be :)
>> Dave
>>
>>
> Frank
>
--
--
Alberto
http://www.linkedin.com/in/aflores
Re: Struts versus Spring newbie question
Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
Dave Newton wrote:
> --- On Mon, 9/15/08, Frank W. Zammetti wrote:
>
>> Woah... I know a lot of people don't like J2EE these days, but does it
>> really take "tens of thousands of available man-hours" to "create your
>> own code to access the J2EE technologies not covered by Struts"?
>>
>
> Depends on how good you want the code to be, I suppose--if you can implement Spring's equivalent in less time, more power to you... but there's a lot in there to implement.
>
>
I think the original question was a little obtuse, but because it's
clear that the OP is new to much of this, we need to be sure we're
giving them a clear picture of things...
Coding against the J2EE APIs directly doesn't take tens of thousands of
hours... not unless a person is especially bad at it anyway :) It's
essentially writing Spring yourself that would almost certainly take
that long. But, one does not beget the other... there are plenty of
people using J2EE directly that haven't spent anywhere near the amount
of time it would take to write Spring yourself, and it's not necessary
to implement Spring's equivalent in many, perhaps even most cases.
None of this is to say that using Spring is a bad idea... it'll almost
certainly save you time and effort, among other benefits... but I don't
think we want to give the impression that Spring is the only viable
alternative. And we don't want to give the impression that someone
using J2EE APIs directly will necessarily wind up re-implementing most
of what Spring already has. Neither of those assertions would be
factually accurate, and to (possibly) give the impression that they are
isn't doing someone new to these technologies a service. It's
absolutely right and helpful to point out where something like Spring
can make your life easier, but we, as people with more experience and
(most likely) expertise, have to be careful not to make it seem like
there isn't a choice here.
> Dave
>
>
Frank
--
Frank W. Zammetti
Author of "Practical Dojo Projects"
and "Practical DWR 2 Projects"
and "Practical JavaScript, DOM Scripting and Ajax Projects"
and "Practical Ajax Projects With Java Technology"
(For info: apress.com/book/search?searchterm=zammetti&act=search)
My "look ma, I have a blog too!" blog: zammetti.com/blog
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Struts versus Spring newbie question
Posted by Dave Newton <ne...@yahoo.com>.
--- On Mon, 9/15/08, Frank W. Zammetti wrote:
> Woah... I know a lot of people don't like J2EE these days, but does it
> really take "tens of thousands of available man-hours" to "create your
> own code to access the J2EE technologies not covered by Struts"?
Depends on how good you want the code to be, I suppose--if you can implement Spring's equivalent in less time, more power to you... but there's a lot in there to implement.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Struts versus Spring newbie question
Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
Dave Newton wrote:
>> ii) Is it really worth learning/using the Spring framework
>> in a J2EE project (not matter if it is with Struts MVC or Spring MVC)
>> or is it better to create your own code to access the J2EE technologies
>> not covered by Struts?
>>
>
> Unless you have tens of thousands of available man-hours then Spring is worth learning. It does, however, depend on what your project's needs are. There are lighter-weight DI/IoC containers--if that's all you're using it for then perhaps it doesn't matter. It has several other aspects (pun!) though.
>
>
Woah... I know a lot of people don't like J2EE these days, but does it
really take "tens of thousands of available man-hours" to "create your
own code to access the J2EE technologies not covered by Struts"? I
mean, JDBC isn't *technically* covered by Struts, and last I checked it
doesn't take more than a few minutes (at MOST) to hack together JDBC
code... likewise, while I'm about a far from a fan of EJB as you can
get, is it really *that* bad?
While I'm all for Spring, I don't think anyone should be scared to NOT
use it, but this sure makes it sound like I should be :)
> Dave
>
>
Frank
--
Frank W. Zammetti
Author of "Practical Dojo Projects"
and "Practical DWR 2 Projects"
and "Practical JavaScript, DOM Scripting and Ajax Projects"
and "Practical Ajax Projects With Java Technology"
(For info: apress.com/book/search?searchterm=zammetti&act=search)
My "look ma, I have a blog too!" blog: zammetti.com/blog
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Struts versus Spring newbie question
Posted by Dave Newton <ne...@yahoo.com>.
--- On Mon, 9/15/08, UseTheFork wrote:
> i) If I have to implement a project using Struts 2.x, would
> you recommend using the Struts MVC or the Spring MVC?
That question doesn't really make any sense--if you're using S2 then you're using the S2 MVC.
> ii) Is it really worth learning/using the Spring framework
> in a J2EE project (not matter if it is with Struts MVC or Spring MVC)
> or is it better to create your own code to access the J2EE technologies
> not covered by Struts?
Unless you have tens of thousands of available man-hours then Spring is worth learning. It does, however, depend on what your project's needs are. There are lighter-weight DI/IoC containers--if that's all you're using it for then perhaps it doesn't matter. It has several other aspects (pun!) though.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Struts versus Spring newbie question
Posted by UseTheFork <jv...@gmail.com>.
Hi Jim, Dave, Alberto and Jeromy,
Thank you for your valuable input. First, I was asking my question from a
MVC perspective,
but it seems like there are subtleties I need to learn. So, if I try to
summarize what your
are saying (and correct me if I am wrong):
a) From a MVC perspective: Struts and Spring are incompatible. However, if I
ignore the MVC
part of Spring, Struts and Spring are perfectly compatible.
b) Still from a MVC perspective: Spring MVC is better then Struts 1.x, but
there are no significant
differences between Spring MVC and Struts 2.x.
c) Spring is interesting, because it provides J2EE facilities not covered by
Struts. That is
why you would want to combine both technologies.
I have two more questions:
i) If I have to implement a project using Struts 2.x, would you recommend
using the Struts MVC
or the Spring MVC?
ii) Is it really worth learning/using the Spring framework in a J2EE project
(not matter if it
is with Struts MVC or Spring MVC) or is it better to create your own code to
access the
J2EE technologies not covered by Struts?
Thank you for your help,
J.
--
View this message in context: http://www.nabble.com/Struts-versus-Spring-newbie-question-tp19492685p19495429.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Struts versus Spring newbie question
Posted by Jeromy Evans <je...@blueskyminds.com.au>.
UseTheFork wrote:
> Hi,
>
> I am exploring the different frameworks used in J2EE. I start to understand
> the Struts concepts and managed to make examples run on my PC. I am now
> exploring Spring.
>
> It seems like Struts and Spring are incompatible. I mean, one has to choose
> either the Spring OR the Struts framework to implement a J2EE application,
> but not both at the same time.
>
> Can someone with more experience than me confirm this?
>
> Thanks,
>
> J.
>
They are perfectly complementary.
http://struts.apache.org/2.0.11.2/docs/spring-plugin.html
Spring MVC, a small subset and optional part of spring is an alternative
technology to Struts2.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Struts versus Spring newbie question
Posted by Jim Kiley <jh...@summa-tech.com>.
Are you talking about Spring's dependency injection features, or Spring MVC?
On Mon, Sep 15, 2008 at 9:12 AM, UseTheFork <jv...@gmail.com> wrote:
>
> Hi,
>
> I am exploring the different frameworks used in J2EE. I start to understand
> the Struts concepts and managed to make examples run on my PC. I am now
> exploring Spring.
>
> It seems like Struts and Spring are incompatible. I mean, one has to choose
> either the Spring OR the Struts framework to implement a J2EE application,
> but not both at the same time.
>
> Can someone with more experience than me confirm this?
>
> Thanks,
>
> J.
> --
> View this message in context:
> http://www.nabble.com/Struts-versus-Spring-newbie-question-tp19492685p19492685.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
Jim Kiley
Technical Consultant | Summa
[p] 412.258.3346 [m] 412.445.1729
http://www.summa-tech.com
Re: Struts versus Spring newbie question
Posted by Dave Newton <ne...@yahoo.com>.
--- On Mon, 9/15/08, UseTheFork wrote:
> It seems like Struts and Spring are incompatible. I mean,
> one has to choose either the Spring OR the Struts framework
> to implement a J2EE application, but not both at the same time.
Depends on what you mean. Struts 2 can use large chunks of Spring via the Spring plugin; all of my S2 projects have used Spring to one extent or another.
I wouldn't use Spring MVC and S2 in the same project, but that's more because it would be silly IMO.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org