type=page
status=published
title=Setting Up a Page
next=jsf-page002.html
prev=jsf-page.html
~~~~~~
Setting Up a Page
=================

[[BNARB]]

[[setting-up-a-page]]
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 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 render kit tag library and the JavaServer Faces
core tag library. The olink:JSFRK[JavaServer Faces standard HTML 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.

For a complete list of JavaServer Faces Facelets tags and their
attributes, refer to the olink:JSFTL[JavaServer Faces Facelets Tag
Library documentation].

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 you create a Facelets XHTML page, include namespace
directives as follows:

[source,oac_no_warn]
----
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/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 the HTML tag library:

[source,oac_no_warn]
----
<h:form ...>
----

The sections link:jsf-page002.html#BNARF[Adding Components to a Page
Using HTML Tag Library Tags] and link:jsf-page003.html#BNARC[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.


