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.
- state management
- managed beans
- 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 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 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.
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 interface management.
- 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
Following things required for JSF
- JDK (Java SE Development Kit)
- JSF 1.2
- 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.
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.
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 sessions.
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:
- JSF Core Tags Library
- JSF Html Tags Library
The six phases of the JSF application lifecycle are as follows (note the event processing at each phase).
- Restore view
- Apply request values; process events
- Process validations; process events
- Update model values; process events
- Invoke application; process events
- Render response
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.
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 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.
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.
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.
Show All Comments