4

The jsf-api.jar contains various localized Messages.properties files that contain, on the one hand a javax.faces.component.UIInput.CONVERSION key as well as on the other hand various javax.faces.converter.* keys.

My questions are:

  • When is the first key used, when is the second key used?
  • Where is this documented?
Student
  • 1,947
  • 2
  • 18
  • 25

1 Answers1

5

The javax.faces.component.UIInput.CONVERSION message will be used when the ConverterException didn't contain a faces message and the component didn't specify the converterMessage attribute. In other words, it's the default/fallback message. The message identifier is specified by the UIInput#CONVERSION_MESSAGE_ID constant which is documented as follows:

CONVERSION_MESSAGE_ID

public static final java.lang.String CONVERSION_MESSAGE_ID

The message identifier of the FacesMessage to be created if a conversion error occurs, and neither the page author nor the ConverterException provides a message.

See Also:

Constant Field Values


The javax.faces.converter.* messages will be used when the in the message identifier specified standard JSF converter has failed a specific conversion task. The standard JSF converters are listed in class summary of the javax.faces.convert package summary. E.g. java.faces.converter.DateTimeConverter.* message identifiers will be used by DateTimeConverter which has some message identifier constants listed in its field summary like DateTimeConverter#DATE_ID with a constant value of "javax.faces.converter.DateTimeConverter.DATE" which is documented as follows:

DATE_ID

public static final java.lang.String DATE_ID

The message identifier of the FacesMessage to be created if the conversion to Date fails. The message format string for this message may optionally include the following placeholders:

  • {0} replaced by the unconverted value.
  • {1} replaced by an example value.
  • {2} replaced by a String whose value is the label of the input component that produced this message.

See Also:

Constant Field Values

Note that all message identifiers are listed in chapter 2.5.2.4 of JSF specification. See also JSF converter resource bundle messages for a copy.

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555