Table of Contents
Definition JavaServer Faces(JSF)
JavaServer Faces is a Java specification for building component-based user interfaces for web applications and was formalized as a standard through the Java Community Process being part of the Java Platform, Enterprise Edition.
JavaServer Faces (JSF) is a framework for web-based Java applications that simplifies the development of user interfaces in Java EE applications. JSF uses JavaServer Pages (JSP) as the technology that allows the display of the pages, but it can also accommodate other technologies such as XUL.
There are two essential considerations about JSF
- It is a technology that runs on the server-side and not on the client-side.
- The user interface is treated as a set of UI components, a fundamental concept for understanding JSF technology.
JSF includes:
- A set of APIs to represent components of a user interface, and also manage their status, handle events, validate input, define a page navigation scheme, and support internationalization and accessibility.
- A default set of components for the user interface.
- A server-side event model· State administration and also,
- Managed beans.
What are the objectives of JSF?
These design objectives represent the focus of JSF development:
Define a simple set of Java base classes for user interface components, component status, and also input events. These classes will cover the life cycle aspects of the user interface, controlling the state of a segment during the life cycle of its page.
Provide a set of components for the user interface, including standard HTML elements to render a form. You can derive these components from a basic set of base classes that you can use to define new components.
Provide a JavaBeans model for sending events from the client-side user interface controls to the server application.
Define APIs for input validation, including support for client-side validation.
Specify a model for the internationalization and localization of the user interface.
Automate the generation of appropriate outputs for the client’s purpose, taking into account all the client’s available configuration data, such as the browser version.
The elements that a JSF application includes are
- A set of JSP pages.
- A set of beans. These beans define properties and functions for the UI components of a page.
- JSF has a configuration file for application resources.
- It has a deployment descriptor.
- JSF has a set of custom objects, developed by the programmer (validators, converters, etc.).
- It has a set of custom tags that allow you to work with custom objects.
Steps of the Application Development Process in JSF
Define a simple set of Java base classes for user interface components, component status, and input events. These classes will cover the life cycle aspects of the user interface, controlling the state of a segment during the life cycle of its page.
Provide a set of components for the user interface, including standard HTML elements to render a form. You can derive these components from a basic set of base classes that can be useful to define new components.
- Provide a JavaBeans model for sending events from the client-side user interface controls to the server application.
- Define APIs for input validation, including support for client-side validation.
- Specify a model for the internationalization and localization of the user interface.
- Automate the generation of appropriate outputs for the client’s purpose, taking into account all the client’s available configuration data, such as the browser version.
Developing a simple JavaServer Faces application requires completing these steps:
- Develop the model objects, which will contain the data.
- Add the declarations of the controlled bean to the application configuration file.
- Create pages using UI component tags and “core” tags.
- Define navigation between pages.
You can perform these tasks simultaneously or in any order. However, the people doing the tasks will need to communicate during the development process. The author of the pages must know the names of the objects to access them from the page.