JSF

JSF PROJECTS

JSF PROJECT 1

JSF Examples

JSF EXAMPLE

adplus-dvertising
Introduction To JSF

Java Server Faces or JSF for short is another new exciting technology for developing web applications based on Java technologies. This JSF Introduction section introduces you with cool JSF technology.

JSF Overview

JSF was developed by Java Community Process(JCP).This is a community of web application experts. These experts are from different groups like Jakarta Struts, Oracle, Sun, IBM, ATG etc. They all collectively worked together to take the best from existing technologies and removed problems.

JSF Tutorials and Interview Question
JavaServer Faces JSF?

Java Server Faces: JSF is a java based web application framework to simplify the user interface for JEE applications.

JSF uses component-based approach instead of traditional request-driven MVC frameworks.

The User Interface state is persisted at the time of a new page request comes from the client and it will be restored when the request is returned back. JSF uses JSP technology for its display. JSF provides to configuration files, the XML schema instead of DTD. JSP provides the portlet related bug fixes.

JSF Includes
  1. the default set of User Interface components.
  2. state management
  3. managed beans
  4. Unified Expression Language for both JSP and JSF
JSF Releases?

JSF started its journey from version 1.0 and now it has come to its latest version JSF1.2. The listing of versions released so far is

  • JSF 1.2 (11 may 2006): Latest release of JSF specification.
  • JSF 1.1 (27 may 2004): Bug fix release. No specification changes. No HTML renderkit changes.
  • JSF 1.0 (11 mar 2004): Initial release of JSF specification.

There are many releases of 1.1 and 1.2 and these are listed below showing released date also

  • 1.2_04 P01 (20 Mar 2007)
  • 1.2_04 (5 Mar 2007)
  • 1.2_02 (25 Aug 2006)
  • 1.2_01 (14 July 2006)
  • 1.1_02 (24 Apr 2006)
  • 1.1_01 (07 Sep 2004)
JSF Features

JSF is a rich featured framework of JAVA technology.

JSF provides a set of standard features that makes it a powerful and standard among the existing technologies available for the development of web application based on java technologies.

Advantages of JSF?

The major benefits of JavaServer Faces technology are

  1. JavaServer Faces architecture makes it easy for the developers to use.
  2. 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.
  3. Offers a clean separation between behavior and presentation.
  4. Provides a rich architecture for managing component state, processing component data, validating user input, and handling events.
  5. Robust event handling mechanism.
  6. Events easily tied to server-side code.
  7. Render kit support for different clients
  8. Component-level control over statefulness
  9. Highly 'pluggable' - components, view handler, etc
  10. JSF also supports internationalization and accessibility Offers multiple, standardized vendor implementations
Requirement of JSF to get started?

Following things required for JSF

  1. JDK (Java SE Development Kit)
  2. JSF 1.2
  3. Application Server (Tomcat or any standard application server)
  4. Integrated Development Environment (IDE) Ex. Netbeans 5.5, Eclipse 3.2.x, etc.
  5. Once JDK and Application Server is downloaded and configured, one can copy the JSF jar files to JSF project and could just start coding. :-) If IDE is used, it will make things very smooth and will save your time.
JSF Architecture?

When it comes to Java programming, it is important to note that different sublanguages such as JDBC and JSF have different architectures. Knowing the architecture for the language you are writing in is a pretty basic set of facts that you need to know. You may need to take a Javascript for beginners course to get yourself up to speed.

JSF has been built on the Model View Controller (MVC) framework and this allows for applications to be scaled better and has better maintainability. The JSF works with a framework that works well with Java Web and user interfaces that fit well within the MVC.

Different kinds of Bean Scopes in JSF?

JSF supports three Bean Scopes.

  1. Request Scope: The request scope is short-lived. It starts when an HTTP request is submitted and ends when the response is sent back to the client.
  2. Session Scope: The session scope persists from the time that a session is established until session termination.
  3. Application Scope: The application scope persists for the entire duration of the web application. This scope is shared among all the requests and sessions.
The main Tags in JSF?

JSF application typically uses JSP pages to represent views. JSF provides useful special tags to enhance these views. Each tag gives rise to an associated component. JSF (Sun Implementation) provides 43 tags in two standard JSF tag libraries:

  1. JSF Core Tags Library
  2. JSF Html Tags Library
JSF life-cycle Phases?

The six phases of the JSF application lifecycle are as follows (note the event processing at each phase).

  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
JSF Fits For Web Applications?

JSF has many advantages over other existing frameworks that makes it a better choice for Java web application development. Some of the reasons are below

It makes easier to create complex UI for an applicaton using jsf tags.Its APIs are layered directly on top of servlet APIs that enables us to use presentation technology other than JSP,creating your own custom components and rendering output for various client devices.

  • Capacity to handle complexities of UI management: It handles cleanly the complexities of UI management like input validation, component-state management, page navigation, and event handling
  • Clean separation between presentation and logic: One of the greatest advantage of jsf is to clearly separate behaviour and presentation in an application. JSF is based on the Model View Controller (MVC) architecture
  • Shorter development cycle: This separation between logic and presentation enables a wide range of users( from web-page designers to component developers). It allows members of team to focus on their own work only , resulting in division of labour and shorter development cycle.
  • Standard Java framework: JSF is a Java standard which is being developed through Java Community Process (JCP). Several prominent tool vendors are members of the group and are committed to provide easy to use, visual, and productive develop environments for JavaServer Faces.
  • An extensible architecture: JSF architecture has been designed to be extensible.Extensible means additional functionality can be given on the top of JSF core i.e. we can customize the functionality. JSF UI components are customizable and reusable elements. You can extend standard components and create your own complex components like stylish calendar, menu bar etc.
  • Support for multiple client devices: Component developers can extend the component classes to generate their own component tag libraries to support specific client. JSF flexible and extensible architecture allows developers to do so.
  • Flexible rendering model: Renderer separates the functionality and view of the component. So we can create multiple renderers and give them different functionality to get different appearance of the same component for the same client or different.
  • International language support: Java has excellent support for internationalization . It allows you to localize messages with user specific locale. A locale is a combination of a country, a language, and a variant code. Java Server Faces adopts this property and let you specify which locale your application supports. So you can display you messages in different languages.
  • Robust tool support: There are several standard tool vendors like Sun Java Studio Creator who provide robust tools that take advantages of JSF to create server side UI easily.
JSF Components

Components in JSF are elements like text box , button , table that are used to create UI of JSF Applications. These are objects that manage interaction with a user.

JSF Tags

JSF provides various tags for performing operations like JSF table tags, JSF listener and event tags, JSF converter tags, JSF validator tags, JSF ajax tag, etc.

JSF Listeners And Events

In JSF for event handling various built-in tags are provided. A user can use it for handling the events and listening the listener. For example, actionListener, valueChangeListener, setProperyActionListener, phaseListener, event.

Validation In JSF

In JSF to validate data various of built-in tags are provided. A user can use it for validating the data. For example, validateDoubleRange, validateLength, validateLong, validateRegex, validateRequired etc. A user can create its own validatior using Validator interface and @FacesValidator.

JSF Integration

JSF can be integrated with other frameworks like, Spring, JDBC etc.

Download JSF

You can download JSF from the following link http://javaserverfaces.java.net/download.html.