Blogroll
23 Nov 10 What Cato the Elder Has To Do With My Views on JSF & Struts

My previous post received slightly wider distribution and attention than I am normally used to, and unfortunately my little rant/in-joke aimed at JSF & Struts at the very end somewhat detracted from the more serious and core points of the post itself.
Firstly, me and Peter Thomas have a little in-joke going on, whereby we take little jabs at JSF at every opportunity - sort of a modern day geek in-joke equivalent of Cato the Elder who used to end all his speeches in the Roman Senate, regardless of subject with the words “Furthermore I think Carthage must be destroyed”.
Struts - Got Java Web Frameworks Going, Now Outdated
Let’s start with Struts: Struts did an excellent thing once upon a time in that it got the Java Web Framework bandwagon going in a serious way - it became a de facto standard and generally improved the structure of JVM webapps.
However, as much as JVM web frameworks owe a debt of gratitude to the trailblazing work Struts did, Struts is now outdated and antiquated in comparison to other, newer and better frameworks that have taken the lessons learned from Struts and refined many of the rough edges away.
JSF - Vendorware At Birth, Filled With Bad Ideas
So, to my favourite subject of disparage, JSF. Firstly, JSF 1.0 quite literally was donkey poo, and I stand by that statement: “POST” only and a lack of bookmarkable GET URL support is an inexusable omission for anything even aiming to be a web framework. Massively leaky abstractions whereby a developer must know all about the inner workings and lifecycles of the framework was another glaring shortcoming to name a few. There where numerous other objections I had at the time to JSF 1.0 which are still valid, at least for JSF 1.0.
I understand many/some of these shortcomings have been addressed with JSF 2.0, and others by various vendor extensions. Still, I’m not convinced:
I simply don’t like the idea of tag-libs. Why should a developer learn JSF tags, which JSF is largely built around, when HTML/JS/CSS already exist? What is the point? It just seems a bad idea to me when HTML and CSS are the language of the web, not JSF tags.
Further, it’s still vendorware: you pretty much have to buy into a specific vendors stack to get all the bells and whistles of say modern Ajax frameworks, or roll your own tags. This goes back to my first point: if you want to integrate JQuery or some other Javascript framework, the barrier to do so is much higher than if you actually just used HTML, CSS and Javascript. What would you rather buy into, JQuery, an open, de-facto standard, or some vendor specific JSF extension?
To be completely fair on JSF, I haven’t tried it since the 1.x days, but at the time it was so thoroughly flawed, that I find it hard to believe that everything would be addressed in 2.0 unless it is a complete rethink from scratch.
There Are So Many Other Choices That Are Better
With the age of Struts showing, and the many shortcomings of JSF, I find that there simply is no good reason to use one of them, given the multitude of other, decent JVM based web frameworks, just to mention a few:
- Spring MVC,
- Play Framework
- Grails
- LiftÂ
- WicketÂ
- Vaadin
- GWT
- Scalatra + Scalate
- Pinky
The above are just a few JVM based web frameworks targeting different types of problems that quickly come to mind that I would prefer using over JSF and Struts. Why choose Struts or JSF if you have a choice?
