Introduction to JSF Technology

Introduction to JSF Technology


Posted in : Java Posted on : May 25, 2012 at 12:58 PM Comments : [ 0 ]

In this tutorial you will learn about the JSF technology.

Introduction to JSF Technology

In this tutorial you will learn about the JSF technology.

JSF (JavaServer Faces) is a Framework developed by Java Community Process(JCP, community of web application experts) that provides the facility to develop Java technology-based web applications in a component oriented and event driven way. JSF allows to build the server-side user interfaces on the MVC (Model-View-Controller) pattern that assures the design of application is designed with a greater maintainability.

Need To JSF

However there are various technologies are already existed like JSP, Servlet, Struts etc, then why we need to choose the new Framework ?

When you are working with a complex web application and trying to use these existing technologies you may faced, in case of JSP and Servlets, the following problems :

  • Repetition of code : If you have worked already with the JSP you can understand the how boring to write the JSP code, sometimes you had seen, if there are more web forms in a web project the same code is required to write again and again for each web form.
  • Working with HTTP : In case of JSP programmers to manipulate data they are required to take action directly with HTTP request and response objects, but what will happened when an application is not able to map that HTTP requests to component specific event handling on server this may cause the security problem.

Why Switch to JSF

  • Reusability : JSF provides the reusability of code, where in JSP programmers were required to write the same code for each web form if in case of more than one web forms in a web project a JSF programmer will simply define a components for forms and will reuse it on every web forms by drag and drop.
  • Security : JSF provides the security. In JSP sometimes the HTTP requests are unable to map the HTTP request, response object may cause the security problem but, in JSF request and response and validations that are done (mostly) on client side are easily handled by its components, Actionlistener tags, event handler components.
  • Encapsulation : In JSF Event handling and UI logic is encapsulated into a single component.
  • In JSF Data of form is saved automatically and the form is repopulated when displaying at client side.

Components of JSF

    1. API :- Making up of UI components and managed their state as well as it handles the events, validation (server-side), conversion of data, supports i18n (Internationalization) and accessibility, defines page navigation, and allows to be capable of being protruded all these features.
    2. JSP Custom Tag Libraries :- These tags helps in to convey the UI components inside the JSP page and also for writing server-side objects components.

Features Of JSF

  • Managed Beans : A dependency injection system (also known as Backing Beans or Page Beans).
  • EL Integration : Integration with Unified Expression Language in JSF provides to Views an accessibility of managed bean fields and methods using EL.
  • UI Components : Provides set of HTML and web-application specific UI components.
  • Built-in Support : Provides support of Ajax (Asynchronous JavaScript And XML), bookmarking and page-load actions.

Benefits of JSF

  • It's main benefit is to allow a separation between behavior and presentation.
  • It allows for linking the separated pieces of the development process to a single piece by offering a simple programming model.

Major Versions of JSF

  • JSF 2.0 :- A Major release of JSF fall together with Java EE 6, provides more functionality than its lower version to enhanced the performance.
  • JSF 1.2 :- This version coincides with Java EE 5. In this major release many improvements were done in the core systems and the APIs.
  • JSF 1.0 :- An initial version of JSF introduced its specification. It's release was autonomous from any part of Java EE/J2EE release.

Note : At the time of writing this tutorial the current release of JSF is 2.1. In 2.1 version of JSF there is a minor changes have been done.

In JSF using its various features like a well-defined programming model and tag libraries makes development of web applications and their maintenance with server-side UIs ease. A developer can do the following by giving their less effort :

  • On a page components can be dropped by adding component tags.
  • Client-generated events can be wired to server-side application code
  • On a page UI components can be bound to server-side data.
  • A UI can be built that can be reuse and be capable of being protruded.
  • State of UI can be saved and restored farther along the life of server requests.

Following image given below demonstrates that how the user interface created with JSF, runs on the server and returns response of corresponding request to the client.

Go to Topic «PreviousHomeNext»

Your Comment:


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

 
Tutorial Topics