apex:outputText
Displays text on a Visualforce page. You can customize the appearance of <apex:outputText> using CSS styles, in which case the generated text is wrapped in an HTML <span> tag. You can also escape the rendered text if it contains sensitive HTML and XML characters.
Use this component to get user input for a controller method that does not correspond to a field on an sObject. Only <apex:inputField> and <apex:outputField> can be used with sObject fields.
Use with nested param tags to format the text values, where {n} corresponds to the n-th nested param tag. The value attribute supports the same syntax as the MessageFormat class in Java.
In API version 31.0 and earlier, encrypted custom field values that are embedded in the <apex:outputText> component display in clear text. The <apex:outputText> component doesn’t respect the View Encrypted Data permission for users. To prevent showing sensitive information to unauthorized users, use the <apex:outputField> tag instead.
In API version 32.0 and later, encrypted custom field values are masked.
This component supports HTML pass-through attributes using the “html-” prefix. Pass-through attributes are attached to the generated container <span> tag.
The example above renders the following HTML:
The example above renders the following HTML:
The example above renders the following HTML:
| Attribute Name | Attribute Type | Description | Required? | API Version | Access |
|---|---|---|---|---|---|
dir | String | The direction in which the generated HTML component is read. Possible values include “RTL” (right to left) or “LTR” (left to right). | 10.0 | global | |
escape | Boolean | A Boolean value that specifies whether sensitive HTML and XML characters should be escaped in the HTML output generated by this component. If you don’t specify escape=“false”, the character escape sequence displays as written. Be aware that setting this value to “false” may be a security risk because it allows arbitrary content, including JavaScript, that could be used in a malicious manner. | 10.0 | global | |
id | String | An identifier that allows the outputText component to be referenced by other components in the page. | 10.0 | global | |
label | String | A text value that allows to display a label next to the output text | 23.0 | ||
lang | String | The base language for the generated HTML output, for example, “en” or “en-US”. For more information on this attribute, see the W3C specifications. | 10.0 | global | |
rendered | Boolean | A Boolean value that specifies whether the component is rendered on the page. If not specified, this value defaults to true. | 10.0 | global | |
style | String | The style used to display the outputText component, used primarily for adding inline CSS styles. | 10.0 | global | |
styleClass | String | The style class used to display the outputText component, used primarily to designate which CSS styles are applied when using an external CSS stylesheet. | 10.0 | global | |
title | String | The text to display as a tooltip when the user’s mouse pointer hovers over this component. | 10.0 | global | |
value | Object | The text displayed when this component is rendered. This value supports the same syntax as the MessageFormat class in Java. | 10.0 | global |