What Happens at Runtime: Activity Styling

16-2 Web User Interface Developers Guide for Oracle Application Development Framework

16.2 Displaying Output Text and Formatted Output Text

There are two ADF Faces components specifically for displaying output text on pages: outputText, which displays unformatted text, and outputFormatted, which displays text and can include a limited range of formatting options. To display simple text specified either explicitly or from a resource bundle or bean, you use the outputText component. You define the text to be displayed as the value of the value property. For example: af:outputText value=The submitted value was: Example 16–1 shows two outputText components: the first specifies the text to be displayed explicitly, and the second takes the text from a managed bean and converts the value to a text value ready to be displayed for more information about conversion, see Section 6.3, Adding Conversion . Example 16–1 Output Text af:panelGroupLayout af:outputText value=The submitted value was: af:outputText value={demoInput.date} af:convertDateTime dateStyle=long af:outputText af:panelGroupLayout You can use the escape attribute to specify whether or not special HTML and XML characters are escaped for the current markup language. By default, characters are escaped. Example 16–2 illustrates two outputText components, the first of which uses the default value of true for the escape attribute, and the second of which has the attribute set to false. Example 16–2 Output Text With and Without the escape Property Set af:outputText value=lt;h3output amp; headinglt;h3 af:outputText value=lt;h3output amp; headinglt;h3 escape=false Figure 16–1 shows the different effects seen in a browser of the two different settings of the escape attribute. Figure 16–1 Using the escape Attribute for Output Text You should avoid setting the escape attribute to false unless absolutely necessary. A better choice is to use the outputFormatted component, which allows a limited number of HTML tags. As with the outputText component, the outputFormatted component also displays the text specified for the value property, but the value can contain HTML tags. Use the formatting features of the outputFormatted component specifically when you want to format only parts of the value in a certain way. If you want to use the same styling for the whole component value, instead of using HTML within the