Thursday, January 10, 2013

Testdriving Mojarra 2.2.0-m08 on GlassFish 3.1.2.2

We just slipped into 2013 and after a wonderful holiday season it is time to kick off the new posting season on my blog. With all the Java EE 7 specifications moving forward it is finally time to test-drive some of them and give feedback. If you are brave enough you could indeed take the latest GlassFish 4.0 nightly or promoted builds and test the complete integrated suite of specifications. If you have limited time and want some more reliable setup to look at you could also test-drive stuff on the latest GlassFish 3.1.2.2 release.

Installing JSF 2.2
As expected this isn't as convenient as we are used to it. Instead of simply packaging the snapshot dependency into your web-app and turning the classloader around, you will have to replace the bundled module in glassfish/modules for the complete server. I opened a bug on this and hope to get this fixed in the near future. JSF 2.2 is backward compatible with Java EE 6 containers and it should be able to package it in your app. For now just get the latest  Mojarra JSF 2.2.0 Milestone 8 release (javax.faces-2.2.0-m08.jar) and drop it into the glassfish/modules folder. Now rename or move the original javax.faces.jar to a save place. Don't forget to empty the osgi-cache folder of your domain (e.g. glassfish\domains\domain1\osgi-cache). Start your domain and keep an eye on the log-file to spot the Mojarra version:
Mojarra 2.2.0-m08 (-SNAPSHOT 20130107-2105 https://svn.java.net/svn/mojarra~svn/tags/2.2.0-m08@11337)

Test-driving new features
Now go ahead and create a new web project in your favorite IDE. If you are using Maven declare the needed dependency as provided and go ahead implementing some of the new features.
 <dependency>
            <groupId>org.glassfish</groupId>
            <artifactId>javax.faces</artifactId>
            <version>2.2.0-m08</version>
             <scope>provided</scope>
        </dependency>
There is a great overview post What’s new in JSF 2.2? which is a great starting point. Don't forget to check back with the linked JIRA issues to see the latest implementation status of all the features.
Mr. JSF Ed Burns himself gave a great one hour introduction at last years JavaOne titled "What’s New in JSF: A Complete Tour of JSF 2.2" which includes links to all the relevant information and gives a comprehensive overview about the different feature categories. Find the slides and the captured presentation for free on the JavaOne Content Catalog page.

Feature Summary
Six Big Ticket Features (JIRA): HTML5 Friendly Markup Support , Faces Flows, Cross Site Request Forgery Protection, Loading Facelets via ResourceHandler, File Upload Component , Multi-Templating

28 Medium Sized Features (JIRA) in the following areas: Components/Renderers, Facelets, Lifecycle, Managed Beans, Resources

44 Bug Fixes (JIRA) in different areas: Components/Renderers, Ajax, Specification errors and clarifications, EL, Facelets, Lifecycle, Resources

Keep an eye on the progress
It is easy to follow the changes in the JSF space. Most likely because of the very transparent and open way the spec lead is driving it. There are public java.net projects for both the specification and the implementation and you are free to join the specification mailing-lists. There are also issue tracker for both the specification and the implementation and you can also have a look at the updated planning by visiting http://jsf-spec.java.net/planning/.
Further on it is always a good idea to follow Manfred Riem and Ed Burns on twitter. The jsf specification also has its own twitter handle (@jsf_spec)

Give Feedback
Most important is to give feedback. Send comments regarding the specification to the users mailing-list and vote on issues you want to see solved. Another good idea is to help the project by following the Adopt-a-JSR for Java EE 7 guidelines for JavaServer Faces 2.2 (JSR 344)