jsf-api.jar 包含各种本地化的 Messages.properties 文件,这些文件一方面包含 javax.faces.component.UIInput.CONVERSION
键,另一方面包含各种 javax.faces.converter.*
键。
我的问题是:
- 什么时候使用第一个 key ,什么时候使用第二个 key ?
- 此内容记录在哪里?
最佳答案
当 ConverterException
不包含 faces 消息并且组件未指定 converterMessage
属性。换句话说,它是默认/后备消息。消息标识符由UIInput#CONVERSION_MESSAGE_ID
指定。常数为 documented如下:
<小时/>
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 theConverterException
provides a message.See Also:
当消息标识符中指定的标准 JSF 转换器未能完成特定转换任务时,将使用 javax.faces.converter.*
消息。标准 JSF 转换器在 javax.faces.convert
package summary 的类摘要中列出。 。例如。 java.faces.converter.DateTimeConverter.*
消息标识符将由 DateTimeConverter
使用它的字段摘要中列出了一些消息标识符常量,例如 DateTimeConverter#DATE_ID
常数值为 "javax.faces.converter.DateTimeConverter.DATE"
这是 documented如下:
DATE_ID
public static final java.lang.String DATE_ID
The message identifier of the
FacesMessage
to be created if the conversion toDate
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 aString
whose value is the label of the input component that produced this message.See Also:
请注意,所有消息标识符均在 JSF specification 的第 2.5.2.4 章中列出。 。另请参阅JSF converter resource bundle messages获取副本。
关于jsf - javax.faces.component.UIInput.CONVERSION 与 javax.faces.converter.*,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15550330/