The JavaServer Faces API provides a standard framework for building presentation tiers for web applications. Unlike the Servlet API, which focuses on low-level request handling for the HTTP protocol, JSF provides developers with a set of prewritten user interface (UI) components and an event model for wiring interactions between the UI and the objects underlying your application.
The JSF team’s goal was to streamline and standardize web UI development. JSF was also designed to be tool-friendly, allowing IDE vendors to support drag-and-drop user interface generation while retaining standardized, portable code and allowing third parties to develop UI components that any JSF developer can use. JSF is included in the J2EE 1.4 framework, but since it requires only the Servlet 2.3 and JSP 1.1 APIs, JSF applications can be deployed in a J2EE 1.3 environment as well.
This chapter provides a whirlwind introduction to programming with JavaServer Faces. Since JSF IDEs aren’t yet very mature, and this is a Nutshell book anyway, we focus on the underlying code: if you start using a tool later, you’ll have an understanding of how the API itself works, and, of course, you can always write a JSF UI by hand. While JSF might seem more conceptually daunting than other web frameworks, such as Struts, it’s actually quite easy to work with by hand once you’ve gained some basic familiarity with the API.
JSF uses JSP tags to create user interfaces, so if you’ve never written a ...