我想覆盖我的h:message的消息我做了什么我做了message.properties文件并将它添加到faces-config.xml中,就像这样
<application>
<message-bundle>
pk.mazars.basitMahmood.MyMessage
</message-bundle>
</application>
这是文件
javax.faces.converter.DateTimeConverter.DATE = {2}: ''{0}'' could not be understood as a date.
javax.faces.converter.DateTimeConverter.DATE_detail = Invalid date format.
javax.faces.validator.LengthValidator.MINIMUM = Minimum length of ''{0}'' is required.
javax.faces.component.UIInput.REQUIRED = {1}: Value is required
在我的代码中,我使用了类似的东西
<h:inputText id="username" value="#{user.username}"
size="20" required="true" label="Username">
</h:inputText>
<h:message for="username" style="color:red" />
但我得到这样的东西
我想要而不是{1}: value is required
。我得到username: Value is required
。如何用值替换{1}
。我还尝试了{0}
和“{2}”。但我得到了同样的结果?
由于
答案 0 :(得分:3)
这是如何
javax.faces.component.UIInput.REQUIRED = {0} Value is required
{0} instead of {1}
Here a complete Reference to all available message that you can override in JSF 2.0.x
尝试重启网络服务器......
原因javax.faces.component.UIInput.REQUIRED = {0} Value is required
应该有效