After Struts what?

by Shashank Tiwari

Apache Struts is the most popular Java web application framework till date. However, newer developments have rendered it both obsolete and inadequate. There are a few options that are trying to replace it but there is no clear winner yet! Who do you think is leading and worthy of the position? Which framework should you use today if you are a Java web application developer?

Rich application development technologies, AJAX, RIA or whatever other form that they may manifest in, are currently the most popular web UI technologies. However, Java is still the choice at the server side. Because of this some of the server side UI technologies, based on JSP and JavaServlets, are still prevelant. Many times these server side UI technologies work in association with the rich UI technologies. As an example many developers are incorporating AJAX with Java Server Faces (JSF), the new generation server centric web framework specification from Java. Many others are using Java remoting libraries, open source and commercial, to remote JavaScript and ActionScript calls down to the server side.

Does that mean we should adopt one of the frameworks like Apache Shale that work well with JSF? Does it mean we should use a remoting library with Servlets only, as far as the Java part of the web application goes? Or does it mean we should use a framework that does both - i.e. JBoss Seam?

68 Comments

Dan
2007-10-04 14:24:16
Struts 2 may have rendered Struts 1 "obsolete and inadequate", but Struts 2 is strong candidate to consider against Spring MVC, Seam, and other current options.
Nik
2007-10-04 14:43:22
Standards, standards, standards. WebBeans, JSF2, JPA2, Servlet3. Well, when they will become available ;-) And if they aren't perfect then surely WebBeans2, JSF3, JPS3 and Servlet4 will be!1!
Branden
2007-10-04 14:54:58
We use Spring (not spring web flow) in our java web applications, and we love it. I'm not sure what "standards" it deviates from, unless you mean JSF, and for that we don't care: JSF is a mess in our opinion, complicated, overbearing, and it doesn't solve any problems it claims to.


JBoss seam appears to be JBoss's attempt to copy Spring's model and popularity; personally I don't see why you need to go with them unless you like having your entire stack from one vendor.

Paul
2007-10-04 15:50:12
What about Tapestry 5? It's not released yet but it does show a lot of promise.
Simon
2007-10-04 16:25:15
Branden -


I would assume that the standards Spring deviates from is the overall JEE spec, not just JSF. Which isn't necessarily a bad thing - Spring afterall emerged as a replacement for the the nightmare that was J2EE - but it's perfectly true to call it non-standard. It may support many of the individual JEE components - JPA, etc - but has a completely different way of gluing everything together.


Incidentally, Spring and JSF are hardly competing - there's a little overlap with Spring's web layer, but the two complement each other pretty well. We use Spring for the logic and persistence layers, while using a fairly thin java layer for the UI-specific stuff. Works well enough - I don't find JSF quite the failure that you do, though I certainly agree it has it's problems.


Mario Arias
2007-10-04 16:59:40
Stripes is a good option, very fast and near to 0 configuration
Colonel35
2007-10-04 17:16:11
I've seen "Struts is obsolete" posts for a couple of years now from those enchanted by the latest and greatest, and--with due respect--this is merely the latest and one of the least compelling.


None of the RIA technologies I know render Struts obsolete. Certainly, as the market swings (no pun intended) towards richer interfaces, Javascript inevitably becomes more important, but on the whole, Struts is an MVC framework, which is still highly relevant, and Struts 2 in particular offers a wealth of tools that facilitate webapp development and organization. It includes, for example, workflow configuration, advanced templating, type conversion, validation, a rich set of control and form taglibs (including, yes, Ajax-enabled tags), and a host of third-party plugin's for things like reporting, JSF, and Spring.


Spring is certainly very popular (J2EE noncompliance notwithstanding) and offers its own framework, but I believe Struts is a stronger and more coherent framework for webapps--Spring's strength is in a deeper, front-to-back integration sense.


And, since I have development (and debugging) of JavaScript, I'm all for tools--like GWT--that can standardize the outputted JavaScript and provide Java-centric runtimes to facilitate development. But this still isn't a substitute for a proper MVC framework.


PS: I agree, Sun should have buried Swing a while ago, and JavaFX seems half-baked, for now anyway.

Jeff
2007-10-04 17:17:00
IMHO Stripes, Wicket and Tapestry 5 are the best options for the web client side, for the middleware Spring and Hibernate.


Wicket and Tapestry 5 are Component based frameworks very powerful stuff in there and also near 0 configuration.


Stripes my favorite as Mario Arias said it is a MVC as Struts but near 0 configuration, fast and very very easy to use, more easy than Struts 2.

Jeff
2007-10-04 17:27:54
Colonel35 why buried Swing, I love Swing it have it place if you dont like Swing there is another options as SWT or QTJambi very good also GUI frameworks for Java.


JavaFX it is mixed feelings for me I will adopt it if integrate well with Java code as JavaFX script for declare the GUI and use Java code for the events if doesnt work like that I will not adopt it, Still very young to talk about it lets give them time.


Alright this article is about web frameworks not GUI client frameworks my choices still are Stripes, Wicket and Tapestry 5.

Kyle Adams
2007-10-04 18:19:00
My experience with component-based frameworks (Tapestry and JSF) has not been good. They generally feel like they're trying to force a Swing paradigm on the web, which just doesn't work. Wicket may be different, but the best option (IMO) if you want to code your UI in Java seems to be GWT.


In the action-based framework world (my preference), Stripes seems to be the best framework out there, in terms of borrowing good ideas from Ruby on Rails. However, I work for a large company and large companies are leary of new, smaller, less-proven frameworks. Which is one of the reasons WebWorks never took off vs. Struts.


The irony is that WebWorks is now under the Struts 2 brand, which makes it much easier to sell a technologically advanced framework in a corporate environment.


Consequently my pick is Struts 2: it offers the best balance between solid, up-to-date technology and corporate viability.

JS
2007-10-04 19:39:55
IMO, if you want to leverage the Java platform/libraries, AND enter the world of agile development, maybe you should take a quick look at Grails.

  • Grails is built on rock solid foundation (Spring Hibernate Quartz)

  • Groovy is a breeze to learn (for a Java dev that is)

  • All of the Java back-end stuff can still be easily integrated


The Grails community is growing fast + there is a conference in London in 2 weeks. Check it out.


JS.

Michael
2007-10-04 22:26:57
I am personnaly using JSF with IceFaces and Facelets.
JSF itself doesn't really do the job, but the 3 of them together satisfy all I need : AJAX components, templating solution "à la Tiles", integration of J2EE security inside IceFaces tags, Spring Integration...
Jeff
2007-10-04 22:52:50
Kyle Adams, I tryed GWT but my experience with it was bad, It generate a bunch of JS files and I got lost in all that mess. I dont really like code generation tools as GUI builders they tend to generate very messy code. I read GWT 1.4 it is better and more optimized JS code but I would not like all my Web UI javascript based, I like more Wicket aproach. About action frameworks when I saw Stripes I got very excited about it, also I checked Struts 2 it is not bad but I liked more the simplicity of Stripes and have all the features. I wish Stripes join the Apache foundation so companies can take a look at it and embrace it more in the corporate.
Mike Costa
2007-10-05 00:27:14
I love the Web...
I've got two SUN certification before come to the tought that Java is not a 'good' choice to develop WEB appllications.
Now you have so many MVC frameworks that it seem ridiculous to have to learn them all.
The problem it is not the language, but the standards released by SUN: EJB are uselessly complicate, SOAP WS implamentation a real pain, servlets and JSP do not come with any useful specs (such as validation, integrated front controller pattern), JSF do not follow any W3C standards (old and verbose XHTML code, obstrusive javascript), the annotations bad news (no configuration but code expressiveness lost forever).
The final result is that you see a great number of 'BAD' coded Java EE applications out there... and i think it is not developers fault.
Paul Browne - Move over Struts (Article)
2007-10-05 00:45:58
I had a similar article a couple of months ago (link below) , and it's good that you come down a make a recommendation.


My key criteria is for choosing is not technical (as most of the options you mention are pretty good), but commercial (if I learn this, will there be work for me?!)


Paul

Diego
2007-10-05 00:54:45
I completely agree with you, Struts is a technlogy of the past and Swing is great but underused.
JSF is too complex (ever tried to make you own component?). JBoss Seam makes it less verbose (no XML config files ala Struts) but it's not enough.
GWT is impressive, but is all this DHTML stuff the right way to do RIA? I expect something better to come out from Flex or JavaFX.
After Struts what? Stripes!!!
Jeff
2007-10-05 04:06:23
Right now the hot stuff to get jobs are :
1) Classic Struts, 2495 jobs on Dice
2) JSF, 1471 jobs on Dice and rising


all the rest of web frameworks are below 80 jobs on Dice. So it means the Next thing is JSF but remember JSF it is a specification we need frameworks on it as MyFaces so on.


Technically as I said I like more Stripes, Tapestry 5 or Wicket. Those are on a niche but I would prefer to work on those niche than follow the wave as always everybody do. I prefer technical than comercial. Because that way I can work on the things I love to work on.


Mike Costa, I see Java perfect for Web development what else you suggest? Ruby on Rails, Php or Asp.net?, Asp.net it is a disater, Php its messy and ugly language, Ruby on rails it is ok but I feel Java more Strong for enterprise web development check out Stripes it have many ideas borrowed from rails. If you dont like EJB specefication no problem in Java land there is options you can check Spring and Hibernate it really rocks and intagreate well with Stripes and you can have a full stack.

maestroQC
2007-10-05 05:32:33
Did you do any real development using JBoss Seam and JSF?
Mike Costa
2007-10-05 06:01:12
Yes, i've already used both SPRING than HIBERNATE: powerful tools but you have to learn another 2 frameworks to do standard things (GAILS abstarct their use anyway)...
Another problem with Java it is that the language is too verbose to experss simple things...
Take the reflection API: if you have to call, say, a getter method over a private attribute, you finish down writing 10 lines of code or near. In Ruby the same things can be done with no efforts.
The same are with RegEx API (and i like so much regex).
I loved Java, but now it simply seems to not respond to my love with the same enthusiasm...
I've started to develop in RoR and must admit that the framework is impressive (but again far from perfection). The most notable difference is that you are much more productive and it is less difficult to do 'bad' coding.
Do not stick your fingers into your ears: the rising of GROOVY, GRAILS and JRUBY must be a warning for all Java developers.
My toughts for the future of Web Applications?
60/70% of logic will be into client scripting code (say a more powerful version of JavaScript), with a 30/40% of routines and DB access performed by a (much lighter than Java) server side language (Ruby, Groovy, who guess?).
Stay tuned...
Maris
2007-10-05 06:23:44
I use Apache Wicket
Bobby
2007-10-05 06:55:32

...
Mike Costa, I see Java perfect for Web development what else you suggest? Ruby on Rails, Php or Asp.net?, Asp.net it is a disater, Php its messy and ugly language, Ruby on rails it is ok but I feel Java more Strong for enterprise web development check out Stripes it have many ideas borrowed from rails. If you dont like EJB specefication no problem in Java land there is options you can check Spring and Hibernate it really rocks and intagreate well with Stripes and you can have a full stack.
Jeff | October 5, 2007 04:06 AM


Why do you say Asp.net is a disaster?

Jeff
2007-10-05 07:01:12
maestroQC, Yes I have tried JBoss Seam it's a good framework but I'm more confortable with Spring/Hibernate/Stripes.


Mike Costa, I respect your opinion and maybe you are right but I'm not so fan of dynamic scripting languages. Maybe in the far future the next best thing will be a dynamic scripting language on top of the JVM but as I said I don't go where the masses go. I think Java will have it place for a long time and if I want to switch to another language I will look at Scala it is very impressive language with impressive features and it can reuse all the Java api's.

Jeff
2007-10-05 07:15:17
Bobby, When I started with Asp.net it was version 1.1 it was so limited and then with version 2.0 came out it changed many things and yes improved but in the same time I have to relearn many things again as always all Microsoft products change without thinking for their users and I dont trust anymore Microsoft and it is only one vendor blah blah you know the story of M$ plus the markup of Asp.net is very messy similar thing as JSF using JSP.
Yeshwantpur
2007-10-05 08:40:39
I think we should not get obsessed by these Frameworks.These 'Frameworks' come and go every now and then.Basic programming remains same.Right?
The giant software systems/prodcucts have been built oevr the years without these fashionable frameworks.Don't get swayed by these frameworks.
Michael
2007-10-05 09:26:35
Go Ext and keep the jsf. http://www.extjs.com Well engineered, cross browser compatible and an awesome look as well. Don't believe me, go see for yourself. There are some using it with GWT and more.
Vance Dubberly
2007-10-05 10:03:57
I duno. I'm rapidly becoming a fan Rails compiled with JRuby. There is something about cranking out simple stuff really quickly and having the power of the full JDK at your disposal that just makes me giddy.
John
2007-10-05 10:36:36
I'll say Jython and got a new release 2.2. Python is better than Ruby.
Dan
2007-10-05 11:08:22
OH MAN, SEAM IS IT!!!!


Bow before ZOD, all other frameworks (you too rails). The things you can do with Seam you would have to spend ages configuring elsewhere. RichFaces in Seam makes AJAX painless. Integration testing is also heavenly with it's component framework. I love it. For those not using Seam....your ignorance is your downfall, and I mean that in a nice way.


EG
2007-10-05 11:29:38
JSF is the worst solution for the Web. It is all POST. That alone should keep you away from it. Most of the Web is GET.


Also, JSF's automatically generated JavaScript is a Web designer's nightmare. Our senior Web designer hates JSF because its client-side mess.


Most of the Java developers on our team prefer Spring or Struts 1. However, we are forced to use JSF because our architect chose it. She has no Web background. Go figure.

Jason Kratz
2007-10-05 12:35:17
I'm not sure I understand this:


Spring is a great choice if you already use a Spring server side, everybody in your team knows the spring framework well. However, Spring deviates from the standard JavaEE in many ways and I would suggest sticking to the standards.


You are not forced to use any other part of Spring if you want to use Spring MVC and it is a very good web framework. It is easy to learn and quite honestly if you learn how to work with it you pretty much already know how to work with the rest of Spring.


In what way does Spring deviate from Java EE? You say there are many ways yet you don't provide any examples. Spring is widely used and accepted so I'm not sure what you lose by not "sticking with the standards". In fact since Spring provides such nice interfaces to parts of the standards and makes them easier to use I'm not sure why you'd not want to use Spring.

George Jempty
2007-10-05 15:31:06
How about a Java port of the following?


http://code.google.com/p/barebonesmvc-php/


It's just 60 lines and I actually came up with the general concept (applyInputToModel(), applyModelToView()) working on a Struts app for Chuck Cavaness. I've also implemented it for mod_python/python_server_pages, but rather than additional ports of my once-and-for-all solution to MVC (for the web), I'm moving on to solving ORM once-and-for-all; I just have to implement the solution that hit me last Saturday morning when I woke up.


Carry on

Jeff
2007-10-05 18:43:41
I agree JBoss Seam is impressive but it is a full stack and we are comparing web presentation layers, with Seam you can switch web presentation layer as Wicket I think they are working on it instead of JSF. For me is Spring/Hibernate > EJB3, Spring doesn't need an application server it is very lightweight, I can apply Spring even for Desktop applications. Spring is very easy to use and I can choose xml configuration or anottations, With EJB3 without anottations it's a nightmare. Actually Seam without anottations you can get lost in a sea of xml, still complicate without anottations and the glue code that provides Seam.
Jeff
2007-10-05 19:04:25
The point of Spring framework is Middleware, SpringMVC it is just as an addon to the framework so it gives you out of the box a web presentation layer but it is not compulsory to use it you can use any Web presentation layer with Spring as JSF, Wicket, Stripes, Struts so on or heck you can use Spring for the middleware and front-end Swing in a desktop application. Spring Webflow it is also good addon and you can apply it to JSF or Struts so on.
Dan
2007-10-05 23:30:02
Jeff,


FYI, Seam doesn't need an app server either.

Ratta
2007-10-06 00:45:02
Ditto Dan - Seam is the way.


I'm on my third Seam-based site (all based on .war's rather than .ear's) to date. It's simple, straight-forward, and has a ton of functionality built into its core - integrated security, PDF's, templated email, seam-gen, etc. And just as important is the Seam community, which is innovative, productive, large, growing, and friendly.

Guy Mac
2007-10-07 10:28:53
PHP with PEAR component libraries.
John
2007-10-07 23:23:55
Guy Mac, PHP sucks Big time my friend, It is the worst designed scripting programing language in History of IT. I prefer to use Perl any day than PHP. Better go with well designed Languages as Python or Ruby or Java.
Patrick Carroll
2007-10-08 06:11:23
Just spent the weekend at NFJS in Atlanta, and I've seen the future: Groovy and Grails.


I got press-ganged into doing web development about a year-and-a-half ago. I've been using Spring MVC, with Hibernate on the back end. For the stuff I do - mostly CRUD websites - Grails would provide a massive boost.


For the first time in a long time, I'm actually looking forward to a web ui project.

Bob
2007-10-08 08:55:38
I prefer Swing myself.


It's far more cost effective, imo, to bang out a Swing solution as opposed to a web based application. There's simply too many what-if's and technical gotcha's to support multiple browsers. And browsers are slow. And they don't interface with the host computer particularly well.


I used JSF/Facelets for a couple of years and wrote a few complex applications with it. It's far more complex than it needs to be with it's 7 step lifecycle and all.

Patrick Carroll
2007-10-08 12:16:42
Hi Bob,


I'm with you on the Swing thing. The first Java apps I wrote had AWT front-ends (I just missed the 1.0.1/2 event model. Yay!), and writing Swing feels like getting back on a bike: you never forget how.


That said, the web is where the action is at the moment, and my wife likes to receive new shoes on a regular basis. ;^)

Jeff
2007-10-08 18:29:34
If you like Swing programming model, you will love Wicket it is very similar programming model for web application development. You should really check it out, It is very different to JSF it is more close to Swing style but it is a very nice framework and easy to use.
Jeff
2007-10-08 18:42:20
Patrick Right now my favorite web frameworks are Stripes and Wicket. If I have to use JSF or Struts it only because jobs. You can check it out Wicket as I said if you like Swing style programming model or Stripes it is the more simplest, elegant and easy web framework I have seen so far.
Manuel Palacio
2007-10-08 23:43:53
SF is the worst solution for the Web. It is all POST. That alone should keep you away from it. Most of the Web is GET. Also, JSF's automatically generated JavaScript is a Web designer's nightmare


That depends on the JSF implementation. Try the RI instead of MyFaces. It does not generate JavaScript. Also, not ALL is POST. You choose yourself.

Mike Costa
2007-10-09 00:38:08
We are talking about Web or what? Swing? Applets? Flex?
To me the Web have to stay with the W3C standards, not the SUN, IBM, Adobe or Microsoft ones.
Shashank Tiwari
2007-10-09 06:49:24
The responses are so varied, that it is clear most people in the Java community are unsure about what next after Struts!


My response to some of the comments are as follows:


Dan - Yes Struts 2 is a good framework but it is no way as popular as Struts. Its still an action based framework and its new contribution is mostly around support for AJAX. For those who liked WebWork2 its a blessing but for those who prefer the event driven component frameworks (like Apache Shale) its still away from the mark.


Many teams that moved on from Struts did not adopt Struts 2. A blog post by Don Brown had stated what Struts 2 was brining to the table and if you haven't already read it you can read it now -
My history of Struts2 -
http://www.oreillynet.com/onjava/blog/2006/10/my_history_of_struts_2.html


Nik - You are right its a pain to keep up with the standards. especially when the Java community loves to create so many of them . However, its always beneficial to go with the standard than not.Invariably container vendors do provide support for the standards.


Shashank Tiwari
2007-10-09 07:15:44
Branden, Jason, Simon, Patrick and everybody else who spoke about Spring, here is what I have to say:


Spring is a great framework - there is no two ways about that! Spring emerged at the time when J2EE's EJB model was cumbersome and painful to deal with. It provided a lightweight implementation for server side beans. It made programming easy for those who were using EJB then. It also adopted a lot of good OO principles in general for building applications. At that time some of the OO principles were compromised within the world of J2EE because of the constraints of the specification and its implementation. Spring was and is an alternative to J2EE.


On the enterprise Java front the story has changed. J2EE has emerged from being a clunky and heavyweight framework to a lightweight and easy to use framework. Especially with EJB3, the server side beans are much much simpler than its ancestors. They are also far more elegant. Now the big question is - should one use the standard JEE (its no more J2EE, as per Sun!) or should one go with Spring? If there are frameworks that are built on top of standard JEE and provide all (or should I say most) of the features that you need to build web applications, would you not prefer that?


About Seam copying Spring success story -
Because Seam is more recent as compared to Spring this statement could be accurate. However, there are two big differences between Seam and Spring -
1. Seam reuses and integrates, JEE and other JBoss products to build the entire stack, spring pretty much re-implements the whole stack.
2. Seam is built around a stateful model whereas Spring is built around a stateless model. This does not mean that Seam does not support stateless interactions or Spring cannot implement statefulness.


Lastly, as far as web frameworks go, it was rightly pointed out that we should speak of Spring MVC and maybe Spring WebFlow and not Spring as a whole. You can use Spring MVC without Spring but then you are left to do some of the plumbing. The alternative is to adopt the whole stack. If you are already heavily invested in Spring, this is an obvious choice. However, if you don't have that much Spring in place do you want to learn a new model, when you may already be aware of many things JEE. Personally, I like Spring but also hate its XML configuration files, ironically it reminds me of the old EJBs.

Shashank Tiwari
2007-10-09 07:43:52
Manuel,
Why do you say POST is bad and GET is good? The two HTTP methods have a different purpose. For sure a lot of the web resources are accessed using the HTTP GET method. However, that does not make POST a bad method. JSF does rely on POST. Seam defines the concept of a conversation, which is smaller in scope than a session. There can be many logical units of interaction within a session. Each of these unit of interaction is a conversation. Seam treats each GET call as the beginning of a separate conversation, unless deliberately implemented otherwise. This also means that as far as the POST methods make a call within the same JSF lifecycle they are in the same conversation. This is useful and logical. What say?
Shashank Tiwari
2007-10-09 07:53:38
Stripes, Wicket and Tapestry are good frameworks. In fact facelets which is slowly and steadily becoming the defacto JSF view description technology gets its inspiration from Tapestry.


However, they are not extremely popular. Interestingly, those who use it swear by it. Maybe because there is so much to choose from or maybe because there is no strong force like JBoss, the Apache foundation or Interface21 providing the necessary thrust. A few months back, Ed Burns,the JSF spec lead was appealing to some of these guys to join hands in creating the JSF2.0 specification. Maybe they should actively participate.

Shashank Tiwari
2007-10-09 08:02:19
JS, Vance, Patrick, Mike, John and everybody else who spoke about non-Java frameworks - Grails, Rails....


Java is as much a platform as a programming language and certainly frameworks, especially web frameworks, based on programming languages other than Java are becoming popular. Scripting and dynamic languages are always easier to learn and easier to use and they may become the dominant language one day. For now we have 10 million Java developers and rising and maybe the preference will remain with something Java.

Patrick Carroll
2007-10-09 09:11:38
Hi Shashank,


Just FYI, Groovy/Grails are built on Java, and a lot of other stuff (Hibernate, Spring, Quartz, etc.).