Book Image

Mastering JavaServer Faces 2.2

By : Anghel Leonard
Book Image

Mastering JavaServer Faces 2.2

By: Anghel Leonard

Overview of this book

Table of Contents (20 chapters)
Mastering JavaServer Faces 2.2
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
The JSF Life Cycle
Index

Styling UI components with contracts


Based on the preceding example, we can write styles/themes for all the JSF UI components. In this section, you can see an example that focuses on JSF UI components that usually appear in forms such as <h:inputText>, <h:inputTextarea>, <h:selectOneMenu>, <h:selectManyCheckbox>, and so on. Practically, we want to obtain something like the following screenshot (this is just a sample form):

We start by defining a new contract named jsfui. The template is pretty simple, as follows:

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://xmlns.jcp.org/jsf/html"
  xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
  <h:head>
    <title></title>
  </h:head>
  <h:body>
    <h:outputStylesheet name="styles.css"/>
    <div class...