user6008337
user6008337

Reputation: 231

Custom JSF f:validateLenght message without using @FacesValidator class

In this example

<h:inputSecret value="#{contact.password}">
            <f:validator validatorId="passwordValidator"/>
            <f:validateLength minimum="8"/>
</h:inputSecret><br/>

If i put a password shorter than 8 letters i have j_idt10: Validation Error: Length is less than allowable minimum of '8' which is exactly what i want but i would like to rewrite the error message. I can do it using a custom @FacesValidator and i checked if there are some attribute in f:validateLength to do this but i didn't find any. Is writing a FacesValidator the only solution ?

Upvotes: 1

Views: 108

Answers (1)

Nikola
Nikola

Reputation: 623

Use message-bundle (similar but not same as resource-bundle) to override default conversion and validation messages:

https://stackoverflow.com/a/2668602/1072089

Upvotes: 1

Related Questions