Developing Web Applications with JSF
In the previous lesson I mentioned that the JSP specification was created on top of servlets to simplify Web application development and as a step toward the separation of responsibilities between web designers and developers. I also said that you should minimize the use of Java code in a JSP page. But JSP doesn’t enforce this practice. JavaServer Faces (JSF) does, and using it is the best way of developing Java EE web applications with a thin client.
The current version, JSF 2.0, is based on the Facelets framework that was originally an open-source product. You’ll be creating JSF web pages in extensible HTML (.xhtml files), which means that the HTML has to be well-formed — every open tag should have a closing one, the values for the tags’ attributes must be placed in quotes, the elements tags must respect case-sensitivity, and the document must have a single root tag.
Like JSP, the JSF framework is tag-based. But JavaServer Faces has several important advantages over JSP:
- The JSF framework comes with a set of UI components, while JSP uses standard HTML components.
- JSF is event-driven.
- You can’t add Java to .xhtml files, which enforces clean code separation between Java and HTML.
- JSF offers easy navigation between web pages.
- JSF introduces configurable managed beans, which contain processing logic and navigation.
I’ll give you more details on each of these bullet points later in this lesson.
The Big Picture
The JSF framework ...