Editor's Desk

Tuesday Apr 23, 2013

JSF 2.2 Final Draft Approved; Java EE 7 Coming Soon

JavaServer Faces 2.2 (JSR 344) was officially approved on April 18th last week. The results were unanimous, with the exception of a couple of members whose voting rights were suspended (such as Google), and a couple that didn't vote (such as Nokia). JSF 2.2 is part of the Java EE 7 release train, which includes a bunch of other JSRs:

  • Java Persistence API (JPA) 
  • Java API for RESTful Web Services (JAX-RS) 
  • Servlets 
  • Enterprise JavaBeans (EJB)
  • JavaServer Pages 
  • Expression Language 
  • Java Messaging Service (JMS) 
  • Java API for XML-based Web Services (JAX-WS) 
  • Contexts and Dependency Injection for Java EE (CDI) 
  • Bean Validation 
  • Common Annotations (JSR-250)
  • Java Connector Architecture 

There are also a few new JSRs in Java EE 7:

Personally, I'm particularly excited about having a standard API for JSON processing and WebSocket. All of these JSRs have either been approved, or are in the final review stages. According to the Java EE 7 schedule, all of the JSRs are expected to be approved by the end of the month, and the reference implementation (Glassfish 4.0) should be out in the middle of May.

So, what about JSF 2.2? First, keep in mind that even though it's part of Java EE 7, you can still use it without the rest of the release train, although it now requires a minimum of Servlet 3.0 (which ships with Java EE 6 containers). That being said, some new features require CDI. This means that Spring shops will have to roll their own integration with Spring for these features, much like they must do today in order to support JSF's view scope with Spring.

Even though JSF 2.2 is a point release, it includes a few major features, plus several other enhancements and bug fixes. Even though HTML5 has always been supported, it's easier than ever with HTML5-friendly markup (you can now build JSF pages using HTML syntax instead of component tags). Faces flows allow you to package up navigation, pages, and code into easy-to-manage modules. Enhanced Cross-Site Request Forgery (CSRF) protection makes your applications more secure, and finally there is a standard File Upload component. Resource library contracts allow you to swap sets of templates, images, stylesheets, and JavaScript files across your application, simplifying customization for different clients or deployments. Other features include loading Facelets via the ResourceHandler, view actions, and window scope.

We'll be covering more of JSF 2.2 here at JSFCentral.com, but if you want to play with it, you can always check out the most recent Mojarra (reference implementation) snapshot (download it, or specify the Maven dependency). MyFaces isn't too far behind with their support either.