Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Customized error messages for validateLength

 
Rishidharan Somu
Greenhorn
Posts: 8
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can I display a customized error message for the <f:validateLength>?

<h:inputText id="nameField" value="#{Test.name}">
<f:validateLength minimum="2" maximum="6"/>
<h:message for="nameField"/>
</h:inputText>

The error message that is displayed is "testForm:nameField: Validation Error: Value is greater than allowable maximum of '6'".

Is there any way I can change the error message being displayed?
[ November 08, 2008: Message edited by: Rishidharan Somu ]
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make your own messages.properties file, and register it in your faces-config.xml using the <message-bundle> tag. For the properties files, you'll find the full list of messages keys in the JSF specification, 2.5.2.4 Localized Application Messages.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic