Appendix B. JavaServer Faces Tag Libraries

The JavaServer Faces API includes two JSP tag libraries that are used to create the user interface for your applications. The JSF tag library is divided into two parts. The HTML tag library provides tags to produce HTML output, and the core tag library provides utilities that are not specific to the HTML rendering model.

JSF Core Tags

The JSF core tags provide access to all of the JSF features that do not directly relate to HTML rendering. Many of the HTML tags rely on core tags to specify optional features, such as validation functionality.

To use the JSF core tags in a JSP file, you must include the following statement in the file header:

<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

Use of f as the tag namespace prefix is both conventional and highly recommended but not required.

<f:actionListener>

Adds an action listener implementation to the surrounding UIComponent tag, such as an <h:commandLink>. The tag must specify the fully qualified class name of a class implementing the javax.faces.event.ActionListener interface. If you wish to handle action events via a method on a backing bean, use the appropriate attribute on the UI component tag instead.

Table B-1. Attribute for <f:actionListener>

Attribution

Description

type

The fully qualified class name of a class that implements the ActionListener interface

<f:attribute>

Adds an attribute to the surrounding tag. Using this tag is functionally equivalent to setting the attribute value ...

Get Java Enterprise in a Nutshell, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.