• Introduce JSF.
• Learn where JSF came from.
• Understand why and where you should think about using JSF.
• Compare JSF to other frameworks.
• Explore JSF components and makeup at a high level.
Java Server Faces (JSF) is a large framework for building user interfaces; particularly Web application user
interfaces in HTML. The upcoming chapters are meant to serve as an introduction to JSF and are not an
exhaustive exploration of the topic. Resources for more research and education on JSF are provided at the
end of these chapters.
This first JSF chapter gives an overview of what JSF is, where it came from and generally how it works from
a high level. You examine JSF’s makeup in more detail in subsequent chapters.
What is JavaServer Faces(JSF)?
According to many definitions, including one from Sun Microsystems , JSF is a Java framework for building
user interfaces. Specifically for developing Web applications rendered in HTML, but it can also be used to
develop user interfaces for other displays. For example, JSF can be used to render WML, XUL, or mobile
Java Micro Edition client applications.
JSF is also a specification. JSR-127 is managed by the Java Community Process (JCP). It defines the
organization and structure of a framework that multiple vendors can implement. By the way, JSR-252 defines
the latest version of JSF (version 1.2). JSF 1.2 is part of JEE 5. JSF is mandated in order to be a full JEE 5
JSF has been described as…
- Swing for the Web or Swing for the server-side; referring to its UI components and event handling
- Visual Basic for Java; referring to the fact that JSF lends itself to visual development
tools/environments to aid in the development of UIs.
- Struts++; referring to its resemblance to other model-view-controller (MVC) application
frameworks like Struts and Tapestry.
MVC design separates applications into three general portions.
- The Model is the business rules and most commonly how the persistent information (Database) is
- The View is the presentation, or how the application looks.
- The Controller represents how the application reacts to user input.
This separation of concerns allows the view and model to be independent of each other.
- The model can remain unchanged when the view changes.
- The model and view can use completely different technologies.
- The Controller (in a way) serves as the glue between the model and the view.
JSF implements the model-view-controller (MVC) architecture. A special JSF “Faces” servlet, special JSF
JavaBeans (backing beans) and event listeners serve in the role of controller. Typically (for HTML Web
applications), JSF JSP pages with JSF custom tags, associated UI components and the JSF renderer handle
the view. JavaBeans provide the basis for the JSF model. More on each of these is discussed later.
Where did JSF come from?
JSF was started by an expert group in May 2001.
- The specification and reference implementation (by Sun) was first released in March 2004.
- Version 1.1 was made available in May 2004.
- Version 1.2 was just released in August 2006.
The co-lead of the JSF expert group was Craig McClanahan. McClanahan was the original author of Apache
Struts. He is the architect of the Catalina Tomcat container. He also served on expert groups for servlet and
It developed from a need to provide rapid user-interface development to server-side Java. JSPs and servlets,
while very scalable and portable, take a long time to develop. JSF is intended to be a direct competitor to ASP.
NET – providing tools that “simplify building Java Server application GUIs.”
Why use JSF?
The 8 goals of JSF, as stated right in the JSR, are:
- Create a standard GUI component framework which can be leveraged by development tools to
make it easier for tool users to both create high quality GUIs and manage the GUI's connections to
- Define a set of simple lightweight Java base classes for GUI components, component state, and
input events. These classes will address GUI lifecycle issues, notably managing a component's
persistent state for the lifetime of its page.
- Provide a set of common GUI components, including the standard HTML form input elements.
These components will be derived from the simple set of base classes (outlined in #1) that can be
used to define new components.
- Provide a JavaBeans model for dispatching events from client-side GUI controls to server-side
- Define APIs for input validation, including support for client-side validation.
- Specify a model for internationalization and localization of the GUI.
- Automatic generation of appropriate output for the target client, taking into account all available
client configuration data, such as browser version, etc.
- Automatic generation of output containing required hooks for supporting accessibility, as defined
by WAI (Web Accessibility Initiative).
JSF leverages the capabilities and familiarities of:
- Java Server Pages (JSP). If you are familiar with JSPs you will find JSF “plumbing” to be similar.
- Client-side development. If you are familiar with Swing, many of the UI components and the
event model will seem familiar.
- Server-side frameworks like Struts. JSF is built with a similar architecture.
What you need to do JSF.
JSF applications are standard Java Web applications.
- Requires a standard Web container.
- The Web container must support Servlet specification 2.3 or better.
- The Web container must also support JSP specification 1.2 or better.
- JDK 1.4.1 or higher.
You need an implementation of JSF. Sun provides a reference implementation. JEE 5 SDK contains the JSF
1.2 reference implementation. There are other 3rd party implementations (WebGalileo Faces). There are 3rd
party open source JSF implementations (MyFaces, Smile). Most of the major application vendors
support/implement JSF (IBM, Oracle, Sun) or support the integration of the reference implementation.
While not absolutely required, you will want a JSF supportive IDE. Many popular IDEs (RAD, MyEclipse,
NetBeans, JBuilder, JDeveloper, Studio Creator) now offer JSF development tools. Many of these include
WYSIWYG/drag-and-drop editors. Most IDE and app server vendors still provide a JSF 1.1 implementation.
Table of Contents
Copyright (c) 2008-2013. Intertech, Inc. All Rights Reserved. This information is to be used exclusively as an
online learning aid. Any copying is strictly prohibited.