JavaServer Faces (JSF) is a user interface framework that runs on a Java application server and renders a user interface to a client. The most popular client is a web browser running on a desktop computer, but JSF is not limited to web applications. Although it is a complex technologylearning JSF isn't a trivial taskonce you've learned it, you will be able to build many web applications faster. If you are unfamiliar with JSF, you can learn it by reading the JavaServer Faces Specification, Sun's tutorial (http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSFIntro.html), or one of the reference books written on the subject. Hans Bergsten, one of the spec's contributors, has written an excellent introduction and reference called JavaServer Faces (O'Reilly). I learned JavaServer Faces using that book and Sun's JSF tutorial (which is actually part of the J2EE tutorial) as my primary tools. JavaServer Faces provides a clean separation between the business logic and presentation layers. It establishes a one-to-one mapping between HTTP requests and components. This mapping allows a finer-grained model for a web application than a typical JSP application can provide. With JSF, there is a lifecycle for communication between the web page and the Java beans that makes up the backend. There are listeners that listen for events and renderers that create a view for display to the user. Writing a JSF application is not unlike writing a Swing applicationand it's radically different from writing a typical web application. There are several ways to use Ajax with JavaServer Faces:
This chapter presents one way to add Ajax to a JSF application: using a custom JSF component. We will process the Ajax request through the JSF lifecycle. |