This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts vs Struts2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts vs Struts2" Watch "Struts vs Struts2" New topic
Author

Struts vs Struts2

Vadim Vararu
Ranch Hand

Joined: Jan 03, 2009
Posts: 147
I've been working in java web development for 8-9 months. I think it's time to begin to use a framework and i would like Struts.

I consider which one is better to begin with. Struts 1 seems to be easier, but it gets older through time. How do you think? Which one is better for begining?
Which literature is better for that reason? I've started a few time ago to read some books on Struts2, but i don't like their style. It's given an exempla of struts.xml and they
say to write such and such content. But, they do not explain why do i have to write exactly this and not anything else.....


If you think you've done too much, usually it means you've done too few.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41173
    
  45
Well, Struts 2 is not responsible for the books that get written about it :-)

While Struts 1 is still used widely in existing projects, it's no longer being developed, so unless you have a need to know it (if maybe your company uses it) I wouldn't spend much effort learning it.

But Struts 2 isn't compatible to Struts 1, so for many people it's not the automatic framework of choice to upgrade to (and it's market share is much smaller than that of Struts 1).

So before deciding which one to learn in depth you might want to check out some other frameworks (like JSF, Wicket, Stripes, ...) so you know what frameworks can do for a web app in general.


Ping & DNS - my free Android networking tools app
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I agree with Ulf (except that Struts 1 is still under active development, though few new features are likely to be introduced)--it's worth exploring various frameworks to see which ones work for you.

There is still a surprising amount of new development using Struts 1, although I don't really understand why--even the latest versions would be considered "behind the times" in terms of flexibility, testability, and so on. Unless you have a compelling business reason to learn it (your company uses it, you *want* to work with it, etc.) I'd focus on Struts 2.

Personally I'm still not a huge fan of JSF, although some of the surrounding technology makes it pretty attractive (Seam, for example). I also think JSF and its associated technologies are more complex than things like S2, Wicket, Stripes, Tapestry, and so on, but that's likely to be because of my particular background.

I haven't had the same experience with the S2 books--most of them *do* explain why to write what's being written, provide alternatives, and so on. A book about a specific technology should never be considered a standalone resource--it should be read alongside the official framework documentation. S2, for example, has a reasonably extensive (although somewhat disorganized at times) documentation wiki.

Any book, besides its own information, should be considered a "window" into the API and other documentation. It's almost always up to the reader to explore topics that aren't covered in the book--and the reader will come out a stronger developer in many regards as a result.

Most framework-oriented books also assume a fairly high comfort level with Java and Java web app development in general: most frameworks rely heavily on other libraries and/or frameworks to accomplish what they do. It's usually assumed that book readers have the initiative to go beyond what's written in the book: there's simply no replacement for experimentation and experience.
Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 684


Hi,


I am totally agree with David. If you want to learn some framework then why you think about older version.

That is but obvious that new version get and add new functionality which is not added at version 1.3.

And struts 2 is so advance than 1.3 .It adds so many new features, plug in., It gives rapid development also.

So better to understand concept of struts 1.3 and move to new version.



Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
Struts 1.3 is a solid API and very easy to learn. I suggest learning how to use and extend the framework. Don't pay attention to the age of the API and the fact that there is another version. Many new projects are still using Struts 1.3 and the reason why is that it is still stronger and easier to learn and develop with.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

On that we'll have to agree to disagree; I don't find S1 easier to learn (or teach), and I find it noticeably less easy to develop for. YMMV.
Davie Lin
Ranch Hand

Joined: Aug 05, 2007
Posts: 294
I am currently learning S2 and doing a project for S2 as Mr. Newton probabily knows that I have posted several questions about S2 (Thanks for all your input) Based from the earlier post of this thread, S2 is still not widely used but that's not my concern. I would like to know from your opinion, do you think S2 would gain market share in the next 5 to 10 years? What I am asking is do you believe S2 will have potential growth giving all these nice features that I have yet to learn.

Thanks for your thoughts
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

10 years? I suspect that's looking quite a bit too far ahead in the web application space.

Struts 1 achieved its longevity due to its "perfect storm" timing and functionality. The web app framework space is saturated now, unlike then--IMO it's unlikely there will be another Java web app framework as ubiquitous as S1.

S2 *is* gaining traction, but it's a little late to the game--there are several other attractive alternatives. For me S2 happens to work well with my brain, others might prefer Spring MVC or Stripes, or a more component-oriented framework like Tapestry, Wicket, or JSF.

I'm sure S2 will gain market share, but I wouldn't want to make any predictions regarding how much or for how long--things move pretty quickly these days, and with so many other good alternatives, and the big uptick in other JVM languages and frameworks, nothing will match S1's adoption rates.

(I could, of course, be completely wrong.)
Keith Flo
Ranch Hand

Joined: Nov 29, 2005
Posts: 128

This is an excellent debate!!!

Until now, I would have tended to agree with James Clark ... Struts 1 is solid, proven and reliable ... there are good books and tutorials ad nauseum ...

When I finally took a look at Struts2 (aka WebWork) a few months ago ... I thought the structure a little strange and just blew it off ...

But David Newton's comments are interesting!!! and I think I need to give Struts2 a more careful second look.

Lastly ... why call it Struts2 ??? The frameworks (Struts2 Webwork vs. Struts1.x) aren't similar at all IMHO.


kf
SCJP 5.0 (preparing for SCWCD)
Vitor Santos
Greenhorn

Joined: Mar 11, 2009
Posts: 6
There is a very simple reason why Struts1 is still used: many people knows how to use it, so it doesn't require much trainning, and all design issues are already well known.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

@Vitor: When so many other, better alternatives are available, any of which provide a superior development experience, sticking to the past doesn't make technical or business sense to me. Inertia may well be a reason, but that doesn't make it a *good* one. Better to train people for a month and reap the benefits long-term, it'd pay for itself easily and quickly.
Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 684



HI,


There is a very simple reason why Struts1 is still used: many people knows how to use it, so it doesn't require much trainning, and all design issues are already well known.



Right. But once if for beginner if starts to learn Struts 1.3 and Struts 2.0 and compare which one easy to learn.

Struts 2 is too easy to learn and it provide so advance functionality than 1.3 so code required to develop some thing is too reduce using 2.0.


The development with Struts 2is so fast. And it provide advanced plug-in to integrate it.

Vitor Santos
Greenhorn

Joined: Mar 11, 2009
Posts: 6


@Vitor: When so many other, better alternatives are available, any of which provide a superior development experience, sticking to the past doesn't make technical or business sense to me. Inertia may well be a reason, but that doesn't make it a *good* one. Better to train people for a month and reap the benefits long-term, it'd pay for itself easily and quickly


I agree with you (I am learning Struts 2 and I plan to study other View frameworks as well (Tapestry 5, Shale, Mentawai...)), I just pointed why struts 1 is still a popular choice.

Many times managers and executives really don't care about those things, and it's funny that they make such decisions sometimes (even when they know nothing about Java or web development), so they usually stick to something that's "foolproof". That's why COBOL still has such a large codebase... sometimes the manager/executive sees no value in training if something already has a "good' solution. Sad but true....
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Nishan Patel wrote:

HI,


There is a very simple reason why Struts1 is still used: many people knows how to use it, so it doesn't require much trainning, and all design issues are already well known.



Right. But once if for beginner if starts to learn Struts 1.3 and Struts 2.0 and compare which one easy to learn.

Struts 2 is too easy to learn and it provide so advance functionality than 1.3 so code required to develop some thing is too reduce using 2.0.


The development with Struts 2is so fast. And it provide advanced plug-in to integrate it.


Ok that's something positive for me, I know only Struts 1.x, no knowledge of S2, except the struts-config.xml is changed to struts.xml, with slight change in "How action mapped ?"


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

There's more than a "slight change", it's completely different.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts vs Struts2
 
Similar Threads
[Ask] Template or What? to be a "View" technology for Struts2
why to use struts2.x
Struts2 Annotations
struts2 Vs spring mvc
struts2 book