This chapter gently introduces the JavaServer Faces technology. More importantly, it teaches you how to write your first JSF application to get a feel for how this great technology works. In addition to the sample chapters, this chapter prepares you for the next chapters by introducing the JSF Application Programming Interface (API) and the Application Configuration file. This excerpt comes from chapter two of JavaServer Faces Programming, by Budi Kurniawan (McGraw-Hill/Osborne, ISBN 0-07-222983-7, 2004).
First, you define two taglib directives to use the two JSF tag libraries: HTML and Core. The tag library descriptors for these two libraries can be found in the jsf-ri.jar file, so you do not need to worry about them. The prefix for the HTML tag library is h, and the prefix for the Core tag library is f.
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %><%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>Next are the JSF controls. Note that JSF controls must be enclosed in the opening and closing elements:
Conceptually, the component tree for this JSP page is depicted in Figure 5, with the root omitted. The main component is the form, and the form has four child components.
Remember: This is part one of the second chapter of JavaServer Faces Programming, by Budi Kurniawan (McGraw-Hill/Osborne, ISBN 0-07-222983). Stay tuned for part 2 of "Introduction to JavaServer Faces," where we learn about JSP, JavaBeans, and Model 2. Buy this book!