16.2 A simple JSF application

A JSF application is just like any other Java Web application. It runs in a servlet container, and it typically contains:

JSP pages

Event listeners

Java Beans that hold data and application-specific functionality

Server-side classes, such as database access beans

In addition to these common items, a JSF application also has:

A custom tag library for rendering UI components on a page. This is called the component tag library, and it is provided by the JSF implementation. The component tag library eliminates the need to hardcode UI components in any specific markup language, such as HTML. This results in completely reusable UI components.

A custom tag library for representing event handlers, validators and other actions. This is called the core tag library, and it is provided by the JSF implementation. The core tag library makes it easy to register events, validators and actions on the components.

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 resources.

The example in this section is a simplification of the calculator application, developed in Chapter 17, JavaServer Faces portlet development. This application asks for two numbers and an operator. The application only accepts sum and subtraction operators. After performing the necessary validations, the application shows the result of the operation and lets the user decide if another operation should be done or if the application should be ended.


Redbooks
ibm.com/redbooks