JSF: Java Server Faces

What is JSF?

JavaServer Faces (JSF) is a MVC web framework that simplifies the construction of user interfaces (UI) for server-based applications by using reusable UI components in a page.  It provides facility to connect UI widgets with data sources and to server-side event handlers. JSF specification defines a set of standard UI components and provides an Application Programming Interface (API) for developing components. The JSF enables the reuse and extension of the existing standard UI components.

Benefits

JSF reduces the effort in creating and maintaining applications which will run on a Java application server and will render application UI on to a target client. The JSF facilitates Web application development by

  • providing reusable UI components

  • To make easy data transfer between UI components

  • To manage UI state across multiple server requests

  • To enable implementation of custom components

  • To wiring client side event to server side application code

JSF UI component model

JSF provides developers capability to create Web application from collections of UI components that can render themselves in different ways for multiple client types (for ex. Wireless, HTML browser, or WAP device).

JSF provides

  • Core library

  • Set of base UI components - standard HTML input elements

  • Addition of the base UI components to create additional UI component libraries or to extend existing components.

  • Multiple rendering capabilities that enable JSF UI components to render themselves differently depending on the client types

JSF Architecture

A JSF application is similar to any other Java technology-based web application; it runs in a Java servlet container and contains

  • JavaBeans components as models containing application-specific functionality and data

  • Custom tag library to represent event handlers and validators

  • Custom tag library to deliver UI components

  • The UI components represented as stateful objects on the server

  • The Server-side helper classes

  • Event handlers, navigation handlers and Validators.

  • The application configuration resource file for configuring application resources

JSF - Life Cycle

JSF application lifecycle have six phases which are as follows

  • To restore view phase

  • To Apply request values phase; process events

  • The Process validations phase; process events

  • The Update model values phase; process events

  • To Invoke application phase; process events

  • The Render response phase


Share this post

We are always here to help. If you have a query Send Now