Introduction to Java Server Faces

IntroducionJava Server Faces (JSF) simplifies the development of User Interfaces in a typical Web application. It provides a Component-based Pluggable Architecture for developing and representing User Interface Components. Also bundled with JSF is a whole set of various new features like Event Handling Mechanism, Page Navigation, Input Validation and Conversion. This article provides an overview about JSF Framework and the various core elements that form the basis for a JSF Framework. It then provides a detailed overview about the various phases in the JSF Request Processing Life-cycle. Explained further is the structure of the JSF Configuration File. And finally the article is concluded by providing a sample application that demonstrates the various new features.

Java Server Faces

In Fact, JSF is nothing but an abstraction over the existing Web Framework. JSF is implemented as a Servlet which is called the Faces Servlet. Before the advent of JSF, Servlets and JSP are the predominant ones that form the core components in the development of a Web Application. Let us see the traditional interaction that takes place in a Web Application is developed only with the Servlet and the JSP components that follows the MVC-2 Architecture. A client who is normally a HTML Browser sends a request to the server. The Web Server receives the request, encapsulates the request and then populates this request object with the various parameter values from the client and will send it to the Servlet. The Servlet which acts as a Controller, analyses the request, then will interact with the Model (Java Beans) that executes the various application business logic and then chooses which View to be shown to the User.

Java Server Faces which provides a Component-Based Architecture for developing reusable User Interface Components hides most of the complex stuffs that are happening in the View portion of the MVC-2 Architecture. The framework is not only limited to developing customized User Interface Components but also provides support for various Advanced Features like Event handling Mechanism, Validating User Inputs that are sent by the clients, Easy Page Navigation Mechanism etc. The good thing about Java Server Faces is that the degree of coupling between the UI Components that represent the various behaviour/properties and its Rendering is very low. In fact it is almost nill. So, HTML browsers are not the only target client applications. JSF Applications works even well with WML Browsers.

Basic Element of JSF

Let us examine the various core basic elements in a JSF application. The most significant components in a JSF application are explained as follows :


  • User Interface Components
  • Managed Beans
  • Validators
  • Convertors
  • Events and Listeners
  • Page Navigation
  • Renderers