2012-05-03 128 views
1

我想重寫消息我^ h如何更換佔位符:我的消息我都做什麼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" /> 

但我得到這樣的東西 enter image description here

我想要而不是{1}: value is required。我得到username: Value is required。如何將{1}替換爲值。我也試過{0}和'{2}'。但是我得到了同樣的結果?

感謝

+0

你看到什麼與javax.faces.component.UIInput.REQUIRED = {0}值是必需的? – Daniel

回答