我希望在转换器发生故障时更改错误消息的占位符。
一般情况下,我使用IceFaces组件ice:selectInputDate和转换器f:convertTimeDate。
<ice:selectInputDate ...>
<f:convertDateTime pattern="..." timeZone="..."/>
</ice:selectInputDate>
当'convertTimeDate'失败时,会显示自定义错误消息,如
javax.faces.converter.DateTimeConverter.DATE=The value {0} in field {2} is wrong.
javax.faces.converter.DateTimeConverter.DATE_detail=The value {0} in field {2} is wrong.
有三个占位符,{0},{1},{2}:
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: http://docs.oracle.com/javaee/6/api/javax/faces/convert/DateTimeConverter.html#DATE_ID
问题是IceFaces将标签从“labelId”更改为“pageform:labelId”。 是否可以为{2}使用自定义字符串或使用自定义字符串添加新的占位符{3}?