Friday Jul 17, 2015

Using HTML 5 with JSF 2.2/Java EE 7

Though some people seem to continue to pit JSF against HTML 5, there is little practical reason this needs to be the case. In fact JSF 2.2 specifically and Java EE 7 generally has gone to great lengths to support the fellow HTML 5 body of standards.

It has always been fully possible to use native HTML in JSF pages. There is little reason you would have any practical difficulty in using most key HTML 5 features even with JSF 2.1/Java EE 6 including canvas, web workers, audio, video and local storage. The only clear place where JSF and HTML 5 can collide is while mixing and matching JSF features with newer input/data elements and attributes such as calendar, email, pattern, autofocus and placeholder. The JSF 2.2 expert group created a very novel and easy solution to this problem through pass-through elements and attributes. Using this feature you can start with an HTML 5 native element and add JSF features to it or start with a JSF element and add HTML 5 features to it seamlessly and effortlessly. By far the best write-up on this capability comes from Chicago based Java EE community advocate Josh Juneau. You should take time to read his very well written article published on OTN as well as the Java Magazine.

Washington DC based Java EE community advocate David Heffelfinger will tackle the topic of pushing HTML 5 usage to the max with JSF 2.2/Java EE 7 in his accepted JavaOne 2015 session titled Integrating JavaServer Faces and HTML5. If you can't come to JavaOne 2015 to see him in person we will share the session video with you on this humble blog when it becomes available.

Thursday Mar 05, 2015

JavaOne Replay: 'JSF 2.2'

Kito D. Mann is a well-known and active member in the JSF sphere. He is the editor-in-chief of JSF Central and co-host of the Enterprise Java Newscast. A few years ago, he has written the 'JavaServer Faces in Action' book for Manning. And now in addition to his day job as an enterprise application architecture consultant, Kito is also a member of several JCP Expert Groups (including JSF), a recognized conference speaker, etc. Needless to say that Kito lives and breathes JavaServer Faces!

During last JavaOne, Kito hosted several sessions including 2 sessions on JSF 2.2:  'JSF 2.2 In Action' and 'JSF 2.2 Deep Dive'. Both sessions cover the new features of JSF 2.2 (e.g. Faces Flow, Multi Templating, HTML 5 support, XSRF, etc.) but in a different format. The first session ('JSF 2.2 In Action') is a regular session, i.e. 60min, while the second session ('JSF 2.2 Deep Dive') is longer, almost 2.5 hours! This gave Kito more time to go deeper and in more details on JSF 2.2. So if you know JavaServer Faces but want to dig more about what JSF 2.2 brings, you should definitely watch one of those sessions, they’re both very informative and well illustrated with code and demos.



Monday Feb 16, 2015

Manfred Riem Discusses JSF and Java EE MVC on JSF Central Podcast

Manfred Riem was a guest on the most recent JSF Central Podcast. For those unaware Manfred is the co-specification lead for both JSF 2.3 and Java EE MVC 1.0. Manfred talked about Mojarra, JSF 2.2, JSF 2.3 as well as MVC 1.0. The podcast is available here and you can read the transcript here.

The podcast is led by Kito Mann - well respected enterprise consultant, author, blogger and JSF community member. Kito has been a long time supporter of JSF with a long track record of contributing as a JCP standards group expert.

The newscast is in fact part of the JSF Central portal and covers topics of interest for the JSF ecosystem. Past contributors to the podcast have included folks like Ed Burns, Cagatay Civici, Neil Griffin, Lincoln Baxter and Shay Shmeltzer. All of the podcasts are archived here.

Besides the podcast, the JSF central portal itself is a very valuable resource for the JSF community you should explore. It does a very nice job listing JSF articles, books, projects, products and other resources.

Friday Jan 16, 2015

File Uploads Using JSF 2.2 and Java EE 7

File uploads have long been possible in JSF, usually using third party plugins like PrimeFaces or RichFaces. JSF 2.2 finally adds support for file uploads out of the box. The practical reason for this lag is that the JSF specification has always chosen to support a Servlet version one behind the latest. This is what often makes it possible to use newer versions of JSF on older runtimes, particularly on Servlet containers like Tomcat. Consequently JSF 2.2 can depend on Servlet 3.0 which adds support for multi-part file handling - making the new file upload feature possible. In a pretty well written code driven post, Hantsy Bai explains the file upload support in JSF 2.2/Java EE 7. You can also check out Rama Krishnnan's YouTube video below on the file upload feature:

Interestingly Rama uses Tomcat and an older version of NetBeans but is still able to demo the feature well (he also chooses to do manual header parsing himself). Things are obviously a lot easier with a Java EE 7 server like GlassFish, which is what Hantsy Bai uses instead.

Wednesday Oct 22, 2014

Themes/Resource Library Contracts in JSF 2.2/Java EE 7

Resource Library Contracts are one of the big ticket features in JSF 2.2. There's actually quite a bit to the feature - it allows for logical organization and packaging of the theme/look-and-feel/template for JSF pages. Beyond enabling better modularity, the feature makes it possible to switch page themes at runtime (much like PrimeFaces, RichFaces, etc did in the past). Huseyin Akdogan explains the details of resource library contracts in a code-intensive post. You should also checkout the video below from the GlassFish Videos YouTube channel in which specification lead Ed Burns covers the feature along with JSF 2.2 generally (the video is pretty short - just about fifteen minutes).

The official Java EE 7 Tutorial has a decent section on the basics of  resource library contracts as well.

Friday Sep 26, 2014

Kito Mann's JSF Sessions at JavaOne 2014

For the Java EE track at JavaOne 2014 we are highlighting some key sessions and speakers to better inform you of what you can expect, right up until the start of the conference.

To this end we recently interviewed Kito Mann. Kito has long been a respected JSF consultant, popular speaker, author and JCP expert. He is the editor-in-chief of JSFCentral.com, co-host of the Enterprise Java Newscast, host of the JSF Podcast interview series, and the author of JavaServer Faces in Action from Manning publications (I met him a long time ago in the process of writing EJB 3 in Action).

Kito has one the highest number of talks from a single speaker in the Java EE track this year. We wanted to talk to him about his JSF sessions at JavaOne 2014, as well as JSF generally:

The following are the sessions we talked about:

  • JSF 2.2 Deep Dive: This tutorial is a two-hour deep dive into all the new features in JSF 2.2 and is probably one of the best bits of training you can have on the technology.
  • PrimeTime JSF with PrimeFaces 5: This session is a look into what is new in PrimeFaces 5, easily the most popular part of the JSF plugin ecosystem.
  • JavaServer Faces Antipatterns and Best Practices: This is an invaluable session if you are a JSF user. Kito shares his wealth of experience as a JSF consultant and navigates the best practices, patterns and anti-patterns for the technology.
  • Mobile JavaServer Faces: This is a deeply well researched session on the available resources for developing mobile applications using JSF. If you are a JSF user being asked to develop mobile functionality, this session is definitely for you.
  • JSF 2.2 in Action: In this one hour session, Kito will overview the features introduced in JSF 2.2 using demos and real life context.

Besides Kito's sessions, we have a very strong program for the Java EE track and JavaOne overall - just explore the content catalog. If you can't make it, you can be assured that we will make key content available after the conference just as we have always done.

Thursday May 15, 2014

Going Stateless with JSF 2.2?

One of the things that makes JSF different from other approaches to server-side Java web development is that it offers a much higher level of abstraction and transparently maintains UI state. While this is valuable is making web development feel like more traditional pure MVC UI development (think Swing, AWT or JavaFX), maintaining UI state is not always necessary. In fact, having a stateless view can be a valuable optimization technique as long as you design for it and can afford to do it. In recognition to this fact, JSF 2.2 allows a view to be marked stateless. Ed Burns discussed this feature towards the beginning of his JavaOne 2013 talk titled JSF 2.2 New Features in Context (see embedded video below):

Beyond the video, Thomas Asel provides a detailed explanation of the feature and it's motivation. It's definitely worth a read if you are a JSF user. The entry also references a number of useful resources on the feature.

Wednesday Jan 22, 2014

JSF 2.2 View Actions

View parameters and pre-render view event listeners were two of the key features added in the JSF 2.0/2.1/Java EE 6 time frame to improve bookmarkability and HTTP GET support. However, the problem with the pre-render view event is that it is triggered both when the view initially loads as well as on all subsequent JSF post backs. This makes it harder to use for the common pattern of looking at passed-in page parameters (usually in the URL query string) and doing some page initialization only once. You could get around this by putting in an explicit post back check in your listener, which is often hard to miss and somewhat hard to understand. As a result, the Seam 3 Faces module added a more focused and powerful view action component.

The good news is that JSF 2.2 standardizes the popular Seam 3 view action feature all but as-is. Hantsy Bai explains the very useful new feature well, including a good bit of technical detail.

Friday Dec 27, 2013

A Realistic JSF 2.2 Faces Flows Example

While very basic introductory examples are invaluable in explaining a new API, they can fail to do a rich API justice - especially from the perspective of more experienced developers. For some of us, looking at a slightly more involved, realistic example can shed far better light on the practical value proposition for a technology.

Faces Flows are one of the best hidden gems in Java EE 7. Standardized in JSF 2.2 they enable web application flow state management in an elegant, declarative fashion. In an excellent blog post, Liferay Faces project lead and JSF 2.2 expert group member Neil Griffin takes an in-depth look at Faces Flows. He explains the motivation for the feature, contrasts it with the Java EE 6/CDI 1.0 conversation scope and demonstrates the feature using a very realistic use case and non-trivial example code. There's also the video of Ed Burns and Roger Kitain's JavaOne 2013 JSF 2.2 talk on Parleys.com:

The source slide deck for the talk - titled JSF 2.2 New Features in Context is posted on the JavaOne Content Catalog. Make sure to check out the other great JavaOne 2013 sessions on Parleys.com too!

Thursday Dec 19, 2013

JSF 2.2 New Features in Context

"If the smaller characters are well-written, the whole world of the film becomes enriched. 
It's not the size of the thing, but the detail." 
(Brendan Gleeson)

A lot of airtime is spent on the APIs that were added to Java EE 7 (e.g. WebSocket) and APIs that went through a major revision (e.g. JMS 2.0 or JAX-RS 2.0). But let's not forget that a lot of others APIs have been revised in Java EE 7 and this sometime implies new features, new capabilities.

In this JavaOne session, Roger Kitain and Edward Burns who are both Specification Leads for JavaServer Faces, explains in details some of the important features that were added to JSF 2.2 (e.g. Faces Flow, HTML5-friendly markup, Resource library contracts). Those new features are explained in detail and demonstrated in the context of a self-contained sample application. Ed and Roger also shows that JSF is still relevant in today's enterprise software stack, they finally compares the benefits of upgrading to JSF 2.2 against opting for a totally new architecture.

Thursday Nov 14, 2013

JSF Specification Lead Ed Burns Discusses JSF 2.2 and Java EE7

If you are a JSF user you owe it to yourself to know about JSFCentral. Run by key JSF advocate, consultant and JSF in Action author Kito Mann, it's an excellent resource for everything JSF. In a recent podcast on JSFCentral, Kito chats with celebrated JSF specification lead Ed Burns about JSF 2.2 and Java EE 7. It's an extremely insightful but informal discussion between two powerhouses of the JSF ecosystem. The discussion covers JSF 2.2 features such as HTML 5 support, the flow scope, resource library contracts and CDI alignment as well as Java EE 7, all in the context of broader industry trends. You can read the transcript and listen to the podcast here. There's also the brief JSF 2.2 video from Ed Burns on the GlassFish Videos YouTube channel:

More recently, Ed presented a JavaOne 2013 session titled JSF 2.2 New Features in Context. Stay tuned to Parleys.com for video of the session to be posted (the slide deck is already posted on the linked JavaOne Content Catalog).