JBoss Community Archive (Read Only)

Portlet Bridge 3.0

JSF Facelet View

When creating a JSF Facelet view document it's common to wrap the content with:

<!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://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j">
...
</html>

As a single portlet only reflects a potentially small portion of the HTML markup for a page, a JSF portlet returning the above markup for each portlet can be distracting and potentially problematic.

The recommended way to wrap the content of a JSF Facelet view document for a portlet is:

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

This results in only the relevant content of the portlet markup being returned to the page.

Although it is not relevant to a portlet, it's important to include <h:head> and <h:body> elements so that JSF can process the Facelet correctly.

JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-11 12:26:02 UTC, last content change 2012-08-28 17:43:50 UTC.