JavaServer Faces (JSF) is a standard framework that simplifies
the construction of user interfaces (UI) for server-based applications by
enabling the assembly of reusable UI components in a page. JSF facilitates
the connection of widgets to data sources and to server-side event handlers.
The JSF specification defines a set of standard UI components and provides
an Application Programming Interface (API) for developing components or enables
the reuse and extension of the existing standard UI components.
JSF reduces the effort in creating and maintaining applications that run
on a Java™ application
server and render application UI to a target client. It facilitates Web application
development through:
- Reusable components to create UI.
- Migration of application data to and from the UI.
- Manages UI state across server requests.
- Enables the implementation of custom components.
- Provides model for wiring client-generated events to server-side application
code.
JSF provides component tags for all input fields available and implements
the Model-View-Controller (MVC) design framework ensuring that applications
are well designed and easier to maintain. JSF allows Java programmers
to focus on backend application development that is integrated with the UI.
It allows Web page creators to create UI by assembling pre-built JSF components
that already contain the necessary logic.
JSF Lifecycle
Each JavaServer Faces request that
renders a JSP involves a JSF component tree, also called a view, and goes
through a request processing life cycle made up of phases. The standard phases
of the request processing life cycle begin with building the restore view,
then request values are applied, validations are processed, model values are
updated, and the application is invoked. Once the application is invoked a
response is rendered. During several phases of the request processing life
cycle, events can be queued. The queued events are broadcast to interested
event listeners.
JSF UI component model
JSF enables you to create
Web application from collections of components that can render themselves
in different ways for multiple client types. JSF provides:
- A set of base UI components - standard HTML input elements along with
a core library.
- Extension of the base UI components to create additional UI component
libraries or extend existing components.
- Multiple rendering capabilities that enable JSF UI components to render
themselves differently depending on the client type (for example HTML browser,
wireless or WAP devise).
JSF Development overview
To create a JSF application:
- Define and implement the application Model classes.
- Describe the Model to the framework.
- Create application Views using JSPs.
- Define data validation rules.
- Define View navigation for the Controller