Document Information

Preface

Part I Introduction

1.  Overview

2.  Using the Tutorial Examples

Part II The Web Tier

3.  Getting Started with Web Applications

4.  JavaServerTM Faces Technology

5.  Introduction to Facelets

6.  Unified Expression Language

7.  Using JavaServerTM Faces Technology in Web Pages

Adding Components to a Page Using HTML Tags

Common Component Tag Attributes

The id Attribute

The immediate Attribute

The rendered Attribute

The style and styleClass Attributes

The value and binding Attributes

Adding HTML Head and Body Tags

Adding a Form Component

Using Text Components

Rendering a Text Field With the inputText Tag

Rendering a Password Field With the inputSecret Tag

Rendering a Label With the outputLabel Tag

Rendering a Hyperlink With the h:outputLink Tag

Displaying a Formatted Message With the h:outputFormat Tag

Using Command Components for Performing Actions and Navigation

Rendering a Button With the h:commandButton Tag

Rendering a Hyperlink With the h:commandLink Tag

Adding Graphics and Images With the h:graphicImage Tag

Laying Out Components With the Panel Component

Displaying Components for Selecting One Value

Displaying a Check Box Using the h:selectBooleanCheckbox Tag

Displaying a Menu Using the h:selectOneMenu Tag

Rendering Components for Selecting Multiple Values

Using The SelectItem and SelectItems Components

Using the f:selectItems Tag

Using the f:selectItem Tag

Using Data-Bound Table Components

Displaying Error Messages With the h:message and h:messages Tags

Creating Bookmarkable URLs with h:button and h:link Tags

Using View Parameters

Resource Relocation using h:output Tags

Using Core Tags

8.  Using Converters, Listeners and Validators

9.  Developing With JavaServerTM Faces Technology

10.  Java Servlet Technology

Part III Web Services

11.  Introduction to Web Services

12.  Building Web Services with JAX-WS

13.  Building RESTful Web Services with JAX-RS and Jersey

Part IV Enterprise Beans

14.  Enterprise Beans

15.  Getting Started with Enterprise Beans

16.  Running the Enterprise Bean Examples

Part V Contexts and Dependency Injection for the JavaTM EE Platform

17.  Introduction to Contexts and Dependency Injection for the JavaTM EE Platform

18.  Running the Basic Contexts and Dependency Injection Examples

Part VI Persistence

19.  Introduction to the Java Persistence API

20.  Running the Persistence Examples

21.  The Java Persistence Query Language

22.  Creating Queries Using the Criteria API

Part VII Security

23.  Introduction to Security in the Java EE Platform

24.  Getting Started Securing Enterprise Applications

25.  Getting Started Securing Web Applications

Part VIII JavaTM EE Supporting Technologies

26.  Introduction to JavaTM EE Supporting Technologies

27.  Transactions

28.  Resource Connections

Index

 

Setting Up a Page

A typical JavaServer Faces web page includes the following elements:

  • A set of namespace declarations that declare the JavaServer Faces tag libraries

  • Optionally, the new HTML head (h:head) and body (h:body) tags

  • A form tag (h:form) that represents the user input components

To add the JavaServer Faces components to your web page, you need to provide the page access to the two standard tag libraries: The JavaServer Faces HTML tag library, and the JavaServer Faces core tag library. The JavaServer Faces standard HTML tag library defines tags that represent common HTML user interface components. It is linked to HTML render kit. The JavaServer Faces core tag library defines tags that perform core actions.

Each JavaServer Faces tag must be described by the PDL (Page Declaration Language). For a complete list of JavaServer Faces Facelets tags and their attributes, refer to the PDL documentation at http://java.sun.com/javaee/javaserverfaces/2.0/docs/pdldocs/facelets/index.html.

To use any of the JavaServer Faces tags, you need to include appropriate directives at the top of each page specifying the tag libraries.

For Facelets applications, the XML namespace directives uniquely identify the tag library uri and the tag prefix.

For example, when creating a Facelets XHML page, include namespace directives as follows:

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">

The XML namespace uri identifies the tag library location and the prefix value is used to distinguish the tags belonging to that specific tag library. You can also use other prefixes instead of the standard h or f. However, when including the tag in the page, you must use the prefix that you have chosen for the tag library. For example, in the following web page, the form tag must be referenced using the h prefix because the preceding tag library directive uses the h prefix to distinguish the tags defined in HTML tag library:

<h:form ...>

The following sections, Adding Components to a Page Using HTML Tags and Using Core Tags, describe how to use the component tags from the JavaServer Faces standard HTML tag library and the core tags from the JavaServer Faces core tag library.