JavaServer Faces

Architecture

Java Enterprise Server
A web server which holds containers for JEE components.
Web Container
The Web Container contains JSP pages and servlets, as well as the necessary configuration files.
Java Servlet
A servlet is a Java class which enables the server to respond to particular requests.
JavaServer Pages
Rather than coding servlets as pure Java classes, a JSP page can be created. A JSP page contains static text, as would an HTML page, and dynamic content. The dynamic content may consist of delimited blocks of Java code, or tags. When a JSP page is first requested, the server compiles it into a servlet; it is the servlet which actually fills the request.
Custom Tags
Including Java code in a JSP page mixes logic with presentation, and does not bode well for code reuse. Instead, a library of Java classes confirming to documented conventions can be compiled into a tag library. The library functions are called from a JSP page with an XML-compliant tag syntax. A standard tag library is provided as part of the JSF platform.
JavaServer Faces
Although now a key pillar of high-level Java web development, JavaServer Faces were only added to the JSF specification in 2004, in response to Microsoft's ASP.NET. JavaServer Faces use the same syntax as tags, but are much more complex. They provide many services, including validation and navigation. JavaServer Face components can be bound to JavaBeans (Java classes confirming to documented conventions), which will synchronise their data with the component's properties, and can execute methods in response to component events.
faxes.config
This XML file controls all navigation, and configures backing beans.

State

A backing bean is a Java class which holds data and application logic for a JSF application. A backing bean can be scoped to the session, thereby holding data across page views. (Whether this bean is held in the server's memory, or written to the client as an ASP.NET style ViewState, is configurable for the application.)

Source Files

web/A.jsp
The JSP template for page A.
web/B.jsp
The JSP template for page B.
web/C.jsp
The JSP template for page C.
web/WEB-INF/faces-config.xml
The configuration file, containing the navigation XML and bean declaration.
src/app/Name.java
The backing bean.

Deployment

Deploying JSF applications is a complicated process, best handled by tools. The test application was run from within the IDE.

Tools

A number of high quality IDEs exist for Java. This application was developed with NetBeans, provided freely by Sun. NetBeans has helpful wizards for creating the initial directory structure, and which assist in editing some of the configuration files.

Sun also offers Java Studio Creator, an IDE for visual JavaServer Faces development. This would probably be a better choice for developing complex applications, but is a complexity overkill for this simple test.