Learn Java for Web Development

(Tina Meador) #1
CHAPTER 6: Component-Based Web Development Using JSF 2 265

VDL

JSF uses a view declaration language (VDL) to display a page to the client on various devices such
as the desktop, portables, and so on. The default VDL for JavaServer Faces (JSF) is Facelets,
but JSF allows multiple VDLs, such as JSP.


JSF EL

In the Hello World application in Chapter 5, you saw how to access managed bean properties and
invoke managed bean actions using EL expressions with the delimiters #{ and }. The EL used in JSF
1.0 and 1.1 (and later in JSP versions 1.2 and 2.0) was an extension of the EL that was part of the
JSP Standard Tag Library (JSTL), as explained in Chapter 3. The difference in JSF EL and the JSP
EL is that of evaluation. In JSP, as you have seen in Chapter 3, any ${} expression that appears in
the page is evaluated immediately during page rendering. Such expressions are called immediate
expressions.


JSF allows expressions to be available both during the rendering of the page and when that is
posted back again. This type of expression in JSF is called a deferred expression and is expressed
with the delimiters #{}.


JSF Tag Library

The standard JSF library consists of four parts that the page needs to access in order to use the JSF
components.


   HTML components library: This defines elements that represent common HTML
user interface components. The standard HTML library is accessible in Facelets
and JSP as a tag library with a URI of http://java.sun.com/jsf/html and a
default prefix of h.
 JSF core library: The standard core library is associated with the f: namespace
and provides common application development utilities for validation and
conversion.
 Facelets library: The standard Facelets templating library is accessible in
Facelets as a tag library with a URI of http://java.sun.com/jsf/facelets and a
default prefix of ui.
 Composite library: The standard composite component library is accessible in
Facelets as a tag library with a URI of http://java.sun.com/jsf/composite and
a default prefix of composite.

The standard JSF component libraries are part of the specification and also come with any standard
JSF implementation such as the reference implementation or the MyFaces implementation. The
section that follows shows how to download and install the JSF implementation, known as Mojarra,
and integrate it into a web application.

Free download pdf