Name

<h:outputLabel>

Synopsis

This action represents an instance of the component type registered with the type ID javax.faces.HtmlOutputLabel (by default, an instance of the javax.faces.component.html.HtmlOutputLabel class), combined with a renderer registered with the renderer type ID javax.faces.Label.

The component is rendered as an HTML <label> element with a for attribute set to the client ID for the component identified by the action element’s for attribute value. The <label> element body is generated from the <h:outputLabel> element’s body. While the <h:outputLabel> element supports a value attribute, it’s ignored by the JSF 1.0 reference implementation, but other implementations may respect it and use it as the <label> body.

Warning

With the JSF 1.0 reference implementation, the action element that represents the component identified by the for attribute value must appear before the <h:outputLabel> element in the JSP page or both action elements must be nested within an action element for a component that renders its children, e.g., <h:panelGrid> or <h:panelGroup>. This is because the label renderer requires that the referenced component exists when the output component is rendered. The specification is not clear enough to tell if this is a bug or not, so other implementations may be less restrictive about the ordering and nesting.

Syntax

<h:outputLabel for="componentId"
  [id="id"] [binding="componentBinding"] [rendered="true|false"]
  [value="value"] [converter="converter"] <!-- ...

Get JavaServer Faces 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.