JSF 2.x Update from Ed Burns
InfoQ got a chance to catch up with Ed Burns. Ed is the JSF (Java Server Faces) specification lead and works at Oracle. Ed shared his viewpoints on where JSF stands in light of Ajax, and HTML5 as well as a recap of what happened in JSF 2.0, 2.1 and what is happening in 2.2. Ed covers how JSPs are first processed as Facelets and then fall back to JSP, JSF 2.2 multi-tenancy (task flows and mutli-templating), how JSF will support HTML 5, JSF adoption, high-traffic sites that use JSF, and more.
InfoQ: What were the major changes from JSF 2.0 to JSF 2.1?
JSF 2.1 was a JCP minor revision, and therefore did not have any really big changes. The biggest change we did have, however, was the ability to tell the JSF runtime to pretend that when it sees a JSP Document file, treat it as a Facelets file. In other words, any .jspx page can just start being treated as a Facelets .xhtml page as long as all of the components used on the .jspx page have Facelets analogs. For applications that have large amounts of .jspx files, this is a very useful feature.
We also added a new plugin capability: the FaceletCacheFactory. This factory can be overridden to take control of how Facelet instances are cached. This means JSF could be optimized to serve facelet instances from a relational database, for example.
InfoQ: What are the major changes from JSF 2.1 to JSF 2.2?
Java EE 7 brings multi-tenancy to the EE platform. Because JSF 2.2 is a part of Java EE 7, the two major features are both related to multi-tenancy, but are also quite useful in their own regard. These two features are Task Flows and Multi-Templating.
With Task Flows, there is abundant prior art, much of it already built on JSF. The two big task flow systems that will inspire the manifestation of the feature in JSF 2.2 or Oracle's Fusion Middleware ADF Task Flows, and VMware's Spring Web Flow. The basic idea with task flows is to allow collections of pages that form a logical flow of interaction to be highly cohesive, while maintaining the loose coupling that promotes maintainability.
The prior art for multi-templating is the popular Joomla! CMS system, well known to millions of PHP developers around the world. With multi-templating, you can now bring site-wide page layout to your JSF apps. This goes beyond mere "skinning" by allowing not just the style of individual elements, but their arrangement in the app to be componentized as well.
If you take these two features and put them on top of the easy multi-tenancy of Java EE 7, you can get some real power for creating cloud-ready applications.
A common thread of Java EE 7 is to add multi-tenancy support as part of Java EE 7's cloud support. Having been thrust into PHP world a few times including Joomla. It is interesting, retrospective and forward thinking that JSF would consider prior art from Joomla.
InfoQ: What is being added to JSF 2.2 to support HTML 5.0?
Briefly, I want to get the message out that we are not trying to retrofit JSF 2.2 to be the super awesome HTML 5 framework. HTML 5 is important because it standardizes a thin-server/thick-client architecture. With JSF, the bulk of the UI logic has always resided on the server, and it will continue to do so in JSF 2.2. That said, there are some specific areas of HTML 5 that do make sense for us to leverage:
JSF applications already have large amounts of metadata available to them. We need to find the best way to allow that data to naturally express itself via the corresponding capability in HTML5.
Sectioning and Heading
Just as the lightweight ontology of section values in HTML5 was obtained by searching Google for how people were using their div tags, the same idea can be applied to how people are using their facelet templates.
Form associated elements
InfoQ: Are there any improvements to REST support for JSF 2.1, and JSF 2.2?
Nothing new there aside from what we already added in JSF 2.0, which was the ability to bookmark pages and do proper support for the Post Redirect Get pattern.
InfoQ: Are there any improvements or enhancements to Ajax and partial page rendering? (JSF 2.1, JSF 2.2)
The Ajax story was one of the big features in JSF 2.0. We will only be making small incremental improvements in that area for 2.2.
InfoQ: It seems like JSF has drastically improved since JSF 1.2 days, has adoption of JSF increased?
I believe it has. Naturally, I'm biased, but at this point, when I go out to conferences and speak to people, JSF is much more of a given in many shops than it was two years ago.
It would appear that JSF has grown fairly rapidly in 2010, but slowed down a bit in the first half of 2011 based on job demand.
Job growth is not the best indicator of adoption due to the same job being advertised more than once, skills being cut and paste from one entry to the next, etc. It is an indicator. Also, since JSF is part of Java EE 5 and Java EE 6 at times JSF gets lost in the graph. Same thing happens with Spring MVC versus Spring. Example, some assume if you are using Spring that you are also using Spring MVC so why list it separately.
InfoQ: What big high traffic sites are using JSF?
Since 2006 or so I've been trying to keep a wiki directory of sites using JSF. The page has moved over the years, but is currently being maintained at: RealWorld JSF Links In there, you can see that some very well known brands are using JSF. One amusing note from the links on that wiki page is that JSF is being used on all seven continents.
This list includes RiteAid Pharmacy, Toys R Us, Adidas, Apple Computer, Lufthansa, and many other sites.
InfoQ: Are there any enhancements to JSF component state saving to reduce HTTP session footprint? Were there any changes in JSF 2.0, 2.1 or 2.2?
JSF 2.0 introduced a big improvement in that regard with the partial state saving feature. This feature takes advantage of the fact that the simple fact of having the component tree declared in markup constitutes the default state of a view. Because JSF 2.0 includes Facelets, and because Facelets makes it very cheap to turn a markup page into a tree of runtime UIComponent instances, all we really need to save and restore are the change to the components that happen during each request. We made some small refinements to this feature as it applies to complex components such as data tables in 2.1, but there is nothing big we are planning in this area for JSF 2.2.
InfoQ: Does JSF get a bad rap? Has it improved drastically and just not got the word out?
JSF is a proven and matured technology heavily used in business critical applications worldwide.
Much has been written about JSF in comparison to other similar frameworks. One thing you can take away from such content is that there is no one perfect web framework. All frameworks are abstractions and make compromises to maintain that abstraction. I think the best frameworks are the ones that allow drawing a good balance between "time to market" and "pain of maintenance".
That said, I think it is widely accepted that JSF has improved dramatically since 1.0, and I think it has gotten the word out. I'll point to Jevgeni Kabanov's 2011 annual ZeroTurnaround Developer Productivity Survey where JSF was shown to be the most popular web framework.
It is true that a lot of frameworks have different tradeoffs. JSF has certainly changed drastically since JSF 1.0.
The annual Jevgeni Kabanov's 2011 annual ZeroTurnaround Developer Productivity Survey is certainly an indicator of JSF adoption, but it did not clearly give the nod to JSF. It stated in the report that it was hard to tell if JSF or Spring MVC is the clear winner because it is hard to
separate Spring users from Spring MVC users (something that was mentioned earlier in this article). A lot of people use Spring with other web frameworks (Struts 1, Struts 2, Wicket, Stripes, Tapestry, etc.), and many assume if you are a Spring shop that you are using Spring MVC as well. It is very likely according to the report that JSF and Spring MVC are equal, but it is difficult to tell. According to the report: "Unfortunately, we haven’t separated Spring MVC from Spring, but we assume-interpret this as you must-that it is at least as popular as JSF. The rest of the frameworks hold a share of 10% or less -GWT is barely over that and is the third most popular."
Chris Mattmann Apr 15, 2014