File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other Application Frameworks and the fly likes Shoul I learn Spring instead of Struts? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Shoul I learn Spring instead of Struts?" Watch "Shoul I learn Spring instead of Struts?" New topic

Shoul I learn Spring instead of Struts?

Wojtek Ciechanowski

Joined: Feb 23, 2005
Posts: 2
I'm newbie J2EE Developer (about 1 year experience). I haven't learn any framework yet, I was using JSP/Servlets and JDBC to create pretty much simple apps.
At first I wanted to learn Struts but now I'm not so sure...

What you recommend for me?
Which is easier to understand and better in terms of future job searching?

days goes by, low light...
Craig Walls
Ranch Hand

Joined: Sep 19, 2003
Posts: 335
Originally posted by Wojtek Ciechanowski:
What you recommend for me?
Which is easier to understand and better in terms of future job searching?

You asked some conflicting questions. First, read what follows as being my opinion...your mileage will vary.

If you are future-thinking, I would recommend getting to know JSF. I'm not a huge JSF fan, but I have a gut feeling that it's the "next big thing". I am a big fan of Tapestry and I think it might be worth learning as well.

Does that mean that you shouldn't learn Spring? Let me clear something up that a lot of people don't understand. The largest portion of Spring has nothing to do with the web or web frameworks. It's an IoC/AOP container. Sure, it has it's own MVC sub-framework, but the real benefit of learning Spring is to reap the benefits of IoC and AOP (especially through declarative transactions).

Once you've started using Spring in your business layer, you have many choices for web frameworks. You can use Spring MVC which is very similar to Struts, but a bit more versatile (and with that versatility comes a bit of complexity, but it's really not as complex as most people make it out to be). You can also easily use Struts, WebWork/XWork, JSF, or Tapestry to front your applications. My personal favorite (right now) is Tapestry, but I've also thrown Spring MVC and Struts at the front of several of my applications.

So to sum up...I would strongly recommend that you learn Spring, but keeping in mind that it's more than a web framework. It will benefit you regardless of which web framework you choose. Then, for future-thinking, I'd check into JSF or Tapestry. Then again, for right-now-thinking, there are still a lot of Struts jobs out there, so it might behoove you to get to know Struts (and use Spring in your business layer).

Spring in Action - Unleash POJO power in your applications!
Modular Java - Discover the secret weapon to modularity on the Java platform!
XDoclet in Action - Your complete guide to code generation with XDoclet.
louise rochford
Ranch Hand

Joined: Apr 04, 2002
Posts: 119
Struts is much more widely used, has been around for longer & there's more books & forums supporting it.
Spring is better designed (I gather - I haven't used the web tier of it really) & the official Spring forum is well supported, but theres only really the one (rather than lots for Struts).

If the idea is to improve your job prospects, I'd recommend learning Struts. I've seen many a job ad in the last couple of years asking for Struts, but none asking for Spring. This is in the UK - the situation might have progressed in the States (See other post). For almost any other reason, I'd recommend Spring - its a fantastic framework and very well designed. When you've got competent in Struts (& maybe read up a little on EJB & patterns - try the Head First books), it would be well worth taking a look at Spring to see a different way to do things. My personal feeling is that Spring is a better framework than struts (& EJBs), but wouldn't be impressed by someone in a job interview who couldn't back this up with some experience of the standard alternative.
[ February 25, 2005: Message edited by: louise rochford ]
Naina Si
Ranch Hand

Joined: Nov 05, 2003
Posts: 134
Agree with both of u, i'm not sure why struts became so famous in a short period of time.

We never know, in the futute there may be a good demand for Spring as well.
Ken Krebs
Ranch Hand

Joined: Nov 27, 2002
Posts: 451
Just keep in mind that the web MVC part of Spring is just a small part of what it has to offer. The much bigger part is for the middleware part of your apps where it offers IOC, AOP, and makes many J2EE API's a lot easier to use.

kktec<br />SCJP, SCWCD, SCJD<br />"What we observe is not nature itself, but nature exposed to our method of questioning." - Werner Heisenberg
K Huang
Ranch Hand

Joined: Dec 12, 2002
Posts: 55
In our current project, we are using Struts, Spring, AppFuse and Hibernate all together. Spring may not replace Struts. But it is good to work with Struts.
I agree. Here's the link:
subject: Shoul I learn Spring instead of Struts?
jQuery in Action, 3rd edition