<apex: outputText> Component in Visualforce PageThe <apex: outputText> is another important component for displaying text on a Visualforce page. The text generated from the <apex: outputText> is wrapped in an HTML <span> tag. However, we can customize the appearance of the <apex: outputText> by using the CSS. The <apex: outputText> component is used to get the input from the user for the controller method that doesn't correspond to a Salesforce field. This component supports the HTML pass-through attributes by simply adding "html-" prefix. The <apex: outputText> component has the following attributes on the Visualforce page: 1. dir The dir is a string-type attribute used to specify the direction in which the generated HTML component should be read. LTR and RTL are the two possible values for this attribute. Syntax: 2. escape The escape is a Boolean-type attribute used for specifying whether the sensitive HTML and XML characters should be escaped in the generated HTML output by this component. Syntax: 3. label The label is a string-type string used to specify the text that needs to be displayed as a label next to the output text. Syntax: 4. id The id is a string-type attribute that allows this component to be referenced by other components on the page. Syntax: 5. lang The lang is a string-type attribute that specifies the base language used for the generated HTML output. The values can be "en" or "en-US" etc. Syntax: 6. rendered The rendered is a Boolean-type attribute used to specify whether this component is rendered on the page. By default, its value is set to true. Syntax: 7. style The style is a string-type attribute used to specify the CSS that needs to be applied to it. Inline CSS is used as a value for this attribute. Syntax: 8. styleClass The styleClass is a string-type attribute used to specify the external CSS stylesheet that needs to be applied to it to display the output text. Syntax: 9. title The title is a string-type attribute used to specify the text that needs to be displayed as a tooltip when the mouse hovers over this component Syntax: 10. value The value is an Object-type attribute used to specify the text displayed when the component is rendered on the page. Syntax: Let's take an example to understand how we can use the <apex: outputText> component inside the VF page: ApexOutputTextExample.vfp ApexOutputTextController.vfp Output |