Skip to Content
Facelets
book

Facelets

by Robert Swarr
March 2007
Beginner to intermediate content levelBeginner to intermediate
101 pages
2h 41m
English
O'Reilly Media, Inc.
Content preview from Facelets

Chapter 3. Developing JSF Views with Facelets

3.1 Building the Good Eats! Homepage with Facelets

This chapter does something you are unlikely to do once you are familiar with Facelets. It creates a web page without using a Facelets template in order to simplify the introduction to Facelets, Nonetheless, it demonstrates two of the three core ideas of Facelets discussed in the first chapter: JSF integration and compositions. After you are introduced to templates in the next chapter, you'll understand why you'll typically develop a Facelets view using templates.

The purpose of this chapter is to introduce the reader to the basics of developing views with Facelets. For this introduction, it performs a walk through of a prototype homepage for the Good Eats! web site. This example includes the key elements of a Facelets view: the XHTML view document, the Expression Language (EL) bindings, the JSF backing bean, the Facelets ui:include and ui:composition tags, and how to style Facelets views with CSS. We'll cover these elements at a high level in order to give you an overview of developing JSF views with Facelets. The goal of this chapter is to show you how all of these elements work together. Subsequent chapters will elaborate upon separate Facelets elements in detail.

3.2 The Facelets View File

Facelets views are xhtml documents that use the following declaration:

Example 7. 

<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Java™ Performance

Java™ Performance

Charlie Hunt, Binu John
JavaServer Faces

JavaServer Faces

Hans Bergsten
Core JavaServer™ Faces

Core JavaServer™ Faces

David Geary, Cay S. Horstmann

Publisher Resources

ISBN: 9780596529246Publisher SupportErrata PageSupplemental Content