B Message Keys for Converter and Validator Messages
This chapter includes the following sections:
About ADF Faces Default Messages
ADF Faces provides default text for messages that are displayed when validation or conversion fails. They work together to minimize the chance that a user would see an error message and maximize the chance that a user is able to enter valid values.
The FacesMessage
class supports both summary and detailed messages. The convention is that:
-
The summary message is defined for the main key. The key value is of the form
classname
.
MSG_KEY
. -
The detailed message is of the form
classname
.
MSG_KEY
_detail
.
In summary, to override a detailed message you can either use the setter method on the appropriate class or enter a replacement message in a resource bundle using the required message key.
You can also override the message string globally instead of having to change the message string per instance. You use a message bundle so that the custom string will be available for all instances. For information about overriding default converter and validator error messages globally, see How to Define Custom Validator and Converter Messages for All Instances of a Component.
Placeholders are used in detail messages to provide relevant details such as the value the user entered and the label of the component for which this is a message. The general order of placeholder identifiers is:
-
component label
-
input value (if present)
-
minimum value (if present)
-
maximum value (if present)
-
pattern (if present)
You can also use message bundles to set message strings globally at the application level. See How to Define Custom Validator and Converter Messages for All Instances of a Component.
Message Keys and Setter Methods
In ADF Faces, you can replace the default messages with your own messages by setting the text on the xxxMessageDetail attributes of the validator or converter or by binding those attributes to a resource bundle using an EL expression. You can also use placeholders in the messages to include relevant details.
The following information is given for each of the ADF Faces converter and validators:
-
The set method you can use to override the message.
-
The message key you can use to identify your own version of the message in a resource bundle.
-
How placeholders can be used in the message to include details such as the input values and patterns.
Converter and Validator Message Keys and Setter Methods
A number of converters and validators provided by ADF Faces help you to add conversion and validation capabilities to ADF Faces input components in your application.
The following subsections give the reference details for all ADF Faces converter and validator detail messages.
af:convertColor
Converts strings representing color values to and from java.awt.Color
objects. The set of patterns used for conversion can be overriden.
Convert color: Input value cannot be converted to a color based on the patterns set
Set method:
setMessageDetailConvert(java.lang.String convertBothMessageDetail)
Message key:
org.apache.myfaces.trinidad.convert.ColorConverter.CONVERT_detail
Placeholders:
- {0} The label that identifies the component
- {1} Value entered by the user
- {2} A color example
af:convertDateTime
Converts a string to and from java.util.Date
, and the converse based on the pattern and style set.
Convert date and time: Date-time value that cannot be converted to Date object when type
is set to both
Set method:
setMessageDetailConvertBoth(java.lang.String convertBothMessageDetail)
Message key:
org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_BOTH_detail
Placeholders:
- {0} The label that identifies the component
- {1} Value entered by the user
- {2} Example of the format the converter is expecting
Convert date: Input value cannot be converted to a Date when the pattern or secondary pattern is set or when type
is set to date
Set method:
setMessageDetailConvertDate(java.lang.String convertDateMessageDetail)
Message key:
org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_DATE_detail
Placeholders:
- {0} The label that identifies the component
- {1} Value entered by the user
- {2} Example of the format the converter is expecting
Convert date: Input value cannot be converted to a Date when the pattern or secondary pattern is set or when type
is set to time
Set method:
setMessageDetailConvertTime(java.lang.String convertTimeMessageDetail)
Message key:
org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_TIME_detail
Placeholders:
- {0} The label that identifies the component
- {1} Value entered by the user
- {2} Example of the format the converter is expecting
af:convertNumber
Provides an extension of the standard JSF javax.faces.convert.NumberConverter
class. The converter provides all the standard functionality of the default NumberConverter
and is strict while converting to an object.
Convert number: Input value cannot be converted to a Number, based on the pattern set
Set method:
setMessageDetailConvertPattern(java.lang.String convertPatternMessageDetail)
Message key:
org.apache.myfaces.trinidad.convert.NumberConverter.CONVERT_PATTERN_detail
Placeholders:
- {0} The label that identifies the component
- {1} Value entered by the user
- {2} The specified conversion pattern
Convert number: Input value cannot be converted to a Number when type
is set to number
and pattern
is null or not set
Set method:
setMessageDetailConvertNumber(java.lang.String convertNumberMessageDetail)
Message key:
org.apache.myfaces.trinidad.convert.NumberConverter.CONVERT_NUMBER_detail
Placeholders:
- {0} The label that identifies the component
- {1} Value entered by the user
Convert number: Input value cannot be converted to a Number when type
is set to currency
and pattern
is null or not set
Set method:
setMessageDetailConvertCurrency(java.lang.String convertCurrencyMessageDetail)
Message key:
org.apache.myfaces.trinidad.convert.NumberConverter.CONVERT_CURRENCY_detail
Placeholders:
- {0} The label that identifies the component
- {1} Value entered by the user
Convert number: Input value cannot be converted to a Number when type
is set to percent
and pattern
is null or not set
Set method:
setMessageDetailConvertPercent(java.lang.String convertPercentMessageDetail)
Message key:
org.apache.myfaces.trinidad.convert.NumberConverter.CONVERT_PERCENT_detail
Placeholders:
- {0} The label that identifies the component
- {1} Value entered by the user
af:validateByteLength
Validates the byte length of strings when encoded.
Validate byte length: The input value exceeds the maximum byte length
Set method:
setMessageDetailMaximum(java.lang.String maximumMessageDetail)
Message key:
org.apache.myfaces.trinidad.validator.ByteLengthValidator.MAXIMUM_detail
Placeholders:
- {0} The label that identifies the component
- {1} Value entered by the user
- {2} Maximum length
af:validateDateRestriction
Validates that the date is valid with some given restrictions.
Validate date restriction - Invalid Date: The input value is invalid when invalidDate
is within the list of invalidDays
Set method:
setMessageDetailInvalidDays(java.lang.String invalidDays)
Message key:
org.apache.myfaces.trinidad.validator.DateRestrictionValidator.WEEKDAY_detail
Placeholders:
- {0} The label that identifies the component
- {1} Value entered by the user
- {2} The invalid date
Validate date restriction - Invalid day of the week: The input value is invalid when the value is one of the weekdays specified in invalidDaysOfWeek
Set method:
setMessageDetailInvalidDaysOfWeek(java.lang.String invalidDaysOfWeek)
Message key:
org.apache.myfaces.trinidad.validator.DateRestrictionValidator.DAY_detail
Placeholders:
- {0} The label that identifies the component
- {1} Value entered by the user
- {2} The invalid day of week
Validate date restriction - Invalid month: The input value is invalid when the value has a month specified in invalidMonths
Set method:
setMessageDetailInvalidMonths(java.lang.String invalidMonths)
Message key:
org.apache.myfaces.trinidad.validator.DateRestrictionValidator.MONTH_detail
Placeholders:
- {0} The label that identifies the component
- {1} Value entered by the user
- {2} The invalid month
af:validateDateTimeRange
Validates that the date entered is within a given range.
Validate date-time range: The input value exceeds the maximum
value set
Set method:
setMessageDetailMaximum(java.lang.String maximumMessageDetail)
Message key:
org.apache.myfaces.trinidad.validator.DateTimeRangeValidator.MAXIMUM_detail
Placeholders:
- {0} The label that identifies the component
- {1} Value entered by the user
- {2} The maximum allowed date
Validate date-time range: The input value is less than the minimum
value set
Set method:
setMessageDetailMinimum(java.lang.String minimumMessageDetail)
Message key:
org.apache.myfaces.trinidad.validator.DateTimeRangeValidator.MINIMUM_detail
Placeholders:
- {0} The label that identifies the component
- {1} Value entered by the user
- {2} The minimum allowed date
Validate date-time range: The input value is not within the range, when minimum
and maximum
are set
Set method:
setMessageDetailNotInRange(java.lang.String notInRangeMessageDetail)
Message key:
org.apache.myfaces.trinidad.validator.DateTimeRangeValidator.NOT_IN_RANGE_detail
Placeholders:
- {0} The label that identifies the component
- {1} Value entered by the user
- {2} The minimum allowed date
- {3} The maximum allowed date
af:validateDoubleRange
Validates that the value entered is within a given range.
Validate double range: The input value exceeds the maximum
value set
Set method:
setMessageDetailMaximum(java.lang.String maximumMessageDetail)
Message key:
org.apache.myfaces.trinidad.validator.DoubleRangeValidator.MAXIMUM_detail
Placeholders:
- {0} The label that identifies the component
- {1} Value entered by the user
- {2} The maximum allowed value
Validate double range: The input value is less than the minimum
value set
Set method:
setMessageDetailMinimum(java.lang.String minimumMessageDetail)
Message key:
org.apache.myfaces.trinidad.validator.DoubleRangeValidator.MINIMUM_detail
Placeholders:
- {0} The label that identifies the component
- {1} Value entered by the user
- {2} The minimum allowed value
Validate double range: The input value is not within the range, when minimum
and maximum
are set
Set method:
setMessageDetailNotInRange(java.lang.String notInRangeMessageDetail)
Message key:
org.apache.myfaces.trinidad.validator.DoubleRangeValidator.NOT_IN_RANGE_detail
Placeholders:
- {0} The label that identifies the component
- {1} Value entered by the user
- {2} The minimum allowed value
- {3} The maximum allowed value
af:validateLength
Validates that the value entered is within a given range.
Validate length: The input value exceeds the maximum
value set
Set method:
setMessageDetailMaximum(java.lang.String maximumMessageDetail)
Message key:
org.apache.myfaces.trinidad.validator.LengthValidator.MAXIMUM_detail
Placeholders:
- {0} The label that identifies the component
- {1} Value entered by the user
- {2} The maximum allowed length
Validate length: The input value is less than the minimum
value set
Set method:
setMessageDetailMinimum(java.lang.String minimumMessageDetail)
Message key:
org.apache.myfaces.trinidad.validator.LengthValidator.MINIMUM_detail
Placeholders:
- {0} The label that identifies the component
- {1} Value entered by the user
- {2} The minimum allowed length
Validate length: The input value is not within the range, when minimum
and maximum
are set
Set method:
setMessageDetailNotInRange(java.lang.String notInRangeMessageDetail)
Message key:
org.apache.myfaces.trinidad.validator.LengthValidator.NOT_IN_RANGE_detail
Placeholders:
- {0} The label that identifies the component
- {1} Value entered by the user
- {2} The minimum allowed length
- {3} The maximum allowed length
af:validateRegExp
Validates an expression using Java regular expression syntax.
Validate regular expression: The input value does not match the specified pattern
Set method:
setMessageDetailNoMatch(java.lang.String noMatchMessageDetail)
Message key:
org.apache.myfaces.trinidad.validator.RegExpValidator.NO_MATCH_detail
Placeholders:
- {0} The label that identifies the component
- {1} Value entered by the user
- {2} The expected pattern