background image

Setting Up a Page

<< Deploy the Example Application | The uri Attribute Value >>
<< Deploy the Example Application | The uri Attribute Value >>

Setting Up a Page

A listener element that identifies the ContextListener class used to create and remove
the database access.
A servlet element that identifies the FacesServlet instance.
A servlet-mapping element that maps FacesServlet to a URL pattern.
Nested inside a jsp-config element is a jsp-property-group element, which sets the
properties for the group of pages included in this version of Duke's Bookstore. See
"Setting
Properties for Groups of JSP Pages" on page 179
for more information.
To run the example, open the URL http://localhost:8080/bookstore6 in a browser.
Setting Up a Page
A typical JavaServer Faces page includes the following elements:
A set of tag library declarations that declare the two JavaServer Faces tag libraries
A view tag
A form tag
This section tells you how to add these elements to your pages and briefly describes the subview
tag for including JavaServer Faces pages inside other pages.
To use the JavaServer Faces UI components in your JSP page, you need to give the page access to
the two standard tag libraries: the JavaServer Faces HTML render kit tag library and the
JavaServer Faces core tag library. The JavaServer Faces standard HTML render kit tag library
defines tags that represent common HTML user interface components. The JavaServer Faces
core tag library defines tags that perform core actions and are independent of a particular
render kit.
Using these tag libraries is similar to using any other custom tag library. This chapter assumes
that you are familiar with the basics of using custom tags in JSP pages (see
"Using Custom Tags"
on page 172
).
As is the case with any tag library, each JavaServer Faces tag library must have a TLD that
describes it. The html_basic TLD describes the JavaServer Faces standard HTML render kit tag
library. The jsf_core TLD describes the JavaServer Faces core tag library.
Refer to the TLD documentation at
http://java.sun.com/javaee/javaserverfaces/1.2/docs/tlddocs/index.html
for a
complete list of the JavaServer Faces tags and their attributes.
To use any of the JavaServer Faces tags, you need to include these taglib directives at the top of
each page containing the tags defined by these tag libraries:
<%@ taglib uri=
"http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri=
"http://java.sun.com/jsf/core" prefix="f" %>
Setting Up a Page
The Java EE 5 Tutorial · September 2007
322