Using XHTML, Facelets, and Expression Language for rendering pages
Faces applications use files with an xhtml
extension. This extension means that either HTML or custom tags, called Facelets, must adhere to the rules of XML. This means that every tag must be closed. HTML allows for tags such as <br>
and <p>,
while to use these tags in XHTML, there must be an opening tag followed by a closing tag. Tags can also be self-closing by ending in a forward slash such as <br/>
or <p/>
.
Let us look at the index.xhtml
file that is responsible for the user interface.
We begin by declaring that this file is in the XHTML format:
<!DOCTYPE xhtml>
XML documents are checked to ensure all tags are valid. The five namespaces listed here represent the common set of tags available in Faces:
<html xmlns:faces="jakarta.faces" xmlns:ui="jakarta.faces.facelets" xmlns:f...