Conversion, Validation, and the JSF Lifecycle

6-4 Web User Interface Developers Guide for Oracle Application Development Framework To add ADF Faces converters that have tags: 1. In the Structure window, right-click the component for which you would like to add a converter.

2. In the context menu, choose Insert inside UI component, then ADF Faces to

insert an ADF Faces converter, or JSF Core to insert a JSF converter. 3. Choose a converter tag for example, ConvertDateTime. 4. In the Property Inspector, set values for the attributes, including any messages for conversion errors. For additional help, right-click any of the attributes and choose Help . You can set multiple patterns for some ADF Faces converters. For more information, see Section 6.3.2, How to Set Attributes on a Standard ADF Faces Converter . ADF Faces lets you customize the detail portion of a conversion error message. By setting a value for a MessageDetailxyz attribute, where xyz is the conversion error type for example, MessageDetailconvertDate, ADF Faces displays the custom message instead of a default message, if conversion fails. For more information about creating messages, see Chapter 17, Displaying Tips, Messages, and Help.

6.3.2 How to Set Attributes on a Standard ADF Faces Converter

Patterns specify the format of data accepted for conversion. Multiple patterns allow for more than one format. For example, a user could enter dates using a slash or hyphen - as a separator. Not all converters support multiple patterns, although pattern matching is flexible and multiple patterns may not be needed. Example 6–1 illustrates the use of a multiple pattern for the af:convertColor tag in which 255-255-000 and FFFF00 are both acceptable values. Example 6–1 af:convertColor Multiple Patterns af:inputColor colorData={adfFacesContext.colorPalette.default49} id=sic3 label=Select a color value={demoColor.colorValue4} chooseId=chooseId af:convertColor patterns=rrr-ggg-bbb RRGGBB RRGGBB transparentAllowed=false af:inputColor Example 6–2 illustrates the use of an af:convertDateTime tag in which 692007 and 200796 are both acceptable values. Example 6–2 af:convertDateTime Multiple Patterns af:inputDate id=mdf5 value=20040906 label=attached converter af:convertDateTime pattern=yyyyMd secondaryPattern=dMyyyy af:inputDate Example 6–3 illustrates an af:convertNumber tag with the type attribute set to currency to accepts 78.57 and 078.57 as values for conversion. Example 6–3 af:convertNumber Set to Currency Attribute af:inputText label=type=currency value={validate.currency} af:convertNumber type=currency af:inputText