JSF <h:outputText> Tag

It is used to render a plain text. If the "styleClass", "style", "dir" or "lang" attributes are present, render a "span" element. If the "styleClass" attribute is present, render its value as the value of the "class" attribute.


# JSF <h:outputText> Tag Example 1:


<h:outputText value="hello"></h:outputText>

# JSF renders it as plain text

hello

# JSF <h:outputText> Tag Example 2:


<h:outputText value="hello" lang="en" style="color: red"></h:outputText>

# JSF renders it as a HTML span tag


<span style="color: red" lang="en">hello</span>

HTML Output:

JSF H outputtext tag 1

# JSF <h:outputText> Tag attributes

Attribute Description
value It holds current value of this component.
id It is an identifier for this component. This id must be unique. You can use it to access HTML element in CSS and JS file.
style It is used to apply CSS for the component.
class It gives class name to the component. It is used to access component from CSS and JS file.
lang It is used to specify language. It helps to make web page localized.