javascript
Brief description  about Online courses   join in Online courses
OR

JavaServer Faces (JSF)

Khushi   Kumari
Khushi Kumari
Senior Java Professional

Over the last few years, a variety of frameworks for building Java–based web applications have been created. For years, Struts have aided developers build web applications using a variation of the classic Model–View–Controller design paradigm. However, JavaServer Faces (JSF) has become a standard part of the Java EE 5 platform, providing both a user interface component framework and the basis for a web application framework.

JSF Introduction

JavaServer Faces (JSF) is a Java based Web application framework that simplifies the development of user interfaces for enterprise Java applications. JSF applications are implemented in Java on the server, and render as web pages back to clients based on their web requests. JSF provides Web application lifecycle management through a controller servlet; and like Swing, JSF provides a rich component model complete with event handling and component rendering. It is based on other Java standards such as Java Servlets and JavaServer Pages, but it provides a higher–level component layer for UI (user interface) development.

The major benefits of JavaServer Faces technology are:

  • JavaServer Faces architecture makes it easy for the developers to use. In JavaServer Faces technology, user interfaces can be created easily with its built–in UI component library, which handles most of the complexities of user interface management.
  • JavaServer Faces technology offers a clean separation between behavior and presentation.
  • JavaServer Faces technology provides a rich architecture for managing component state, processing component data, validating user input, and handling events.
  • Robust event handling mechanism.
  • Render kit support for different clients
  • Highly 'pluggable' – components, view handler, etc

JSF Lifecycle

In order for you to understand how the framework masks the underlying request processing nature of the Servlet API and to analyze how Faces processes each request, we’ll go through the JSF request processing lifecycle. This will allow you to build better applications.

A JavaServer Faces page is represented by a tree of UI components, called a view. During the lifecycle, the JavaServer Faces implementation must build the view while considering state saved from a previous submission of the page. When the client submits a page, the JavaServer Faces implementation performs several tasks, such as validating the data input of components in the view and converting input data to types specified on the server side. The JavaServer Faces implementation performs all these tasks as a series of steps in the JavaServer Faces request–response life cycle.

The phases of the JSF application lifecycle are as follows:


  1. Restore view
  2. Apply request values; process events
  3. Process validations; process events
  4. Update model values; process events
  5. Invoke application; process events
  6. Render response
Write your comment now