Ajax, JavaScript support and CDI alignment tops the list of what's new in JSF 2.3
It was great to see the 2.3 release of JavaServer Faces finalized last week.
When JSF 2.0 came out, I was quick to jump on the component based UI approach to software development, promoting the framework and writing a number of articles on JSF, Ajax and Facelets development. But after a few projects, my enthusiasm waned and advocacy was replaced with frustration. I soon jumped off the bandwagon, but having said that, looking at what’s new in the JSF 2.3 release, I’m anxious to jump back on.
CDI and JSF 2.3
One of my biggest frustrations with the initial 2.0 release was the lack of alignment between the Java EE CDI specification and the dependency injection used by JSF. I guess it was simply a reality of the fact that JSF needed to be capable of running within a web container that didn’t provide CDI support that forced the original release of JSF 2.0 to provide it’s own set of injectable managed beans, but it created confusion nevertheless, especially given the fact that back in 2009 or 2010, developers were struggling to grasp CDI itself. A clash of CDI and JSF annotations with similar names but dissimilar behaviors created no end of confusion. But looking at what’s new in JSF 2.3, it’s more than assuring to know that CDI alignment was finally achieved. That will make JSF 2.3 adoption a much easier sell for organizations that are well versed in working with contexts and injected dependencies.
What else is new in JSF 2.3?
Beyond CDI alignment, new in JSF 2.3 are a variety of features supporting asynchronous programming, shielding the developer from the long page-load times that dogged JSF when applications were developed without the built-in JSF 2.0 Ajax support. Websocket support will make UI rendering lightning fast for those developers who are lucky enough to be working on projects that are allowed to use it, and additional features that bridge the divide between the world of client-side JavaScript and JSF’s server-side component model.
New JSF 2.3 API enhances Ajax support
In terms of JavaScript support, the new JSF 2.3 tag commandScript maps a client-side JavaScript method referenced in an HTML element to a corresponding method on the serverside, and the event that triggers the interaction is completely Ajax based. That’s a much welcomed addition to the spec. Furthermore, the ability to run a variety of script calls on the client side after an Ajax even completes has also been added. The need to do so seemed almost omnipresence when using JavaScript frameworks that aid in the implementation of responsive designs, so developers were coming up with all sorts of ad-hoc methods to do so. It’s nice to see the JSF 2.3 providing relief for that JavaScript headache, and standardizing the Ajax based approach.
Arjan Tijms has an awesome blog giving what appears more insight into what’s new with JSF 2.3 than the actual specification document itself, so I highly recommend it if you’re in the market for a component bases, server-side UI web framework that is aligned with CID, works well with Ajax and plays well with JavaScript. The team that delivered JSR-371, including spec leads Edward Burns and Manfred Riem, did an admirable job.
You can follow Cameron McKenzie on Twitter: @cameronmcnz