Core JavaServer Faces

   

Topics in This Chapter

  • "An Overview of the JSF Core Tags" on page 86

  • "An Overview of the JSF HTML Tags" on page 87

  • "Forms" on page 96

  • "Text Fields and Text Areas" on page 100

  • "Buttons and Links" on page 111

  • "Selection Tags" on page 123

  • "Messages" on page 153

  • "Panels" on page 158

Development of compelling JSF applications requires a good grasp of the JSF tag libraries core and HTML that represent a combined total of 43 tags. Because of their prominence in the JSF framework, this chapter and the next Data Tables provide in-depth coverage of those tags, their attributes, and how you can best use them.

Even simple JSF pages use tags from both libraries. Many JSF pages have a structure similar to this:

<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> <f:view> <h:form> ... </h:form> </f:view>

To use the JSF tag libraries, you must import them with taglib directives, as in the preceding code fragment. You can choose any name you want for the prefixes. The convention is f and h, for the core and HTML libraries, respectively.

This chapter starts with a brief look at the core library. That library, with 18 tags, is smaller than its HTML sibling, which has 25. It's also considerably simpler than the HTML library. Because of that simplicity and because most of the core tags are discussed elsewhere in this book, the overwhelming majority of this chapter focuses on the HTML library.

We begin our exploration of the HTML library with a look at common attributes shared by most JSF HTML tags. Then we discuss each tag individually with attribute tables for reference and useful code examples that you can adapt to your own applications.

NOTE

The core library has 2.8 attributes per tag the HTML library has 26.2.

Категории

© amp.flylib.com,