Apex and Visualforce Controllers - Salesforce Exam DEV-501

Apex and Visualforce Controllers

Question

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.

This component does take localization into account.

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.

See the MessageFormat class JavaDocs for more information.

Warning:Encrypted custom fields 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.

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

D.

The correct answer is D. apex:outputText.

The apex:outputText component is used to display text on a Visualforce page. It is a basic component and can be customized using CSS styles. When using CSS styles, the generated text is wrapped in an HTML <span> tag. It also provides the option to escape the rendered text if it contains sensitive HTML and XML characters.

This component is useful when you need to display text values that are localized. You can use nested param tags to format the text values, where {n} corresponds to the n-th nested param tag. The value attribute of the apex:outputText component supports the same syntax as the MessageFormat class in Java.

It is important to note that encrypted custom fields that are embedded in the apex:outputText component display in clear text. Additionally, the apex:outputText component does not respect the View Encrypted Data permission for users. To prevent showing sensitive information to unauthorized users, it is recommended to use the apex:outputField tag instead.

In summary, the apex:outputText component is used to display text on a Visualforce page and provides customization options through CSS styles and nested param tags. However, it should not be used to display encrypted custom fields as it does not respect the View Encrypted Data permission.