How can I create a custom message for the errors that accour in the field annotation?
@Size(max = 10)
or
@Column(name = "NAME" , length = 10)
Now I see a message
CustomerDetailsForm:customerName: Validation Error: Length is greater than allowable maximum of ”10” .
How can I change this message?
Use the
messageattribute of the bean validation annotation.To internationalize it, supply
ValidationMessages.propertiesbundle files in the desired locales and use the{}to specify the bundle key, e.g:Alternatively, you can also just use
maxlengthon the<h:inputText>field so that the enduser already won’t be able to enter too much characters.