R4R provide basic JSF Tutorials concept with
JSF Examples .
Through R4R you can develop
JSF programming concept. R4R provide
JSF Interview Questions with answers.R4R provide
JSF Languages study materials in easy way.
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 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.
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.
the default set of User Interface components
Unified Expression Language for both JSP and JSF
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
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 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
advantages of JSF?
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
Offers a clean separation between behavior and presentation.
Provides a rich architecture for managing component state, processing component
data, validating user input, and handling events.
Robust event handling mechanism.
Events easily tied to server-side code.
Render kit support for different clients
Component-level control over statefulness
Highly 'pluggable' - components, view handler, etc
JSF also supports internationalization and accessibility
Offers multiple, standardized vendor implementations
Requirement of JSF to get started?
Following things required for JSF:
JDK (Java SE Development Kit)
Application Server (Tomcat or any standard application server)
Integrated Development Environment (IDE) Ex. Netbeans 5.5, Eclipse 3.2.x, etc.
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.
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
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...
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.
Session Scope: The session scope persists from the time that a session is
established until session termination.
Application Scope: The application scope persists for the entire duration
of the web application. This scope is shared among all the requests and
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
JSF Core Tags Library.
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:
Easy creation of UI:
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)
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
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
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.
JavaServer Faces Application?
JavaServer Faces applications are just like any other Java web application. They
run in a servlet container, and they typically contain the following:
.JavaBeans components containing application-specific
functionality and data.
.Pages, such as JSP pages.
.Server-side helper classes, such as database access beans.
.In addition to these items, a JavaServer Faces application also has:
.A custom tag library for rendering UI components on a page.
.A custom tag library for representing event handlers, validators, and other
.UI components represented as stateful objects on the server.
.Backing beans, which define properties and functions for UI components.
.Validators, converters, event listeners, and event handlers.
.An application configuration resource file for configuring application
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
Show All Comments
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,
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 can be integrated with other frameworks like, Spring, JDBC etc.
You can download JSF from the following link http://javaserverfaces.java.net/download.html.