jsf - javax.faces.component.UIInput.CONVERSION 与 javax.faces.converter.*

标签 jsf properties localization type-conversion converters

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 the ConverterException provides a message.

See Also:

Constant Field Values

<小时/>

当消息标识符中指定的标准 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 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

请注意,所有消息标识符均在 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/

相关文章:

ios - 弱 IBOutlet UIView 属性将变为 nil

regex - 如何匹配 perl 正则表达式 (regexp) 中的重音和波浪号字符?

jsf - Primefaces 图形图像不带 ?pfdrid_c=true

iphone - 自动释放和属性

python - 关于 python 类 __init__ 和装饰器

iOS:无需重启即可更改本地化的 xib

iphone - 更改 AppleLanguages 属性的安全性如何

java - validator 未触发

java - 从网页中的 hashMap 中检索数据

java - 如何在 JSF 中使用应用程序模式