-
1. Re: One way of doing things?
hstang Dec 23, 2006 9:17 AM (in response to tony.herstell1)Override the default message in your own messages.properties:
e.g.
validator.length=Length is not between {min} and {max}
validator.notNull=Cannot be null -
2. Re: One way of doing things?
tony.herstell1 Dec 23, 2006 1:05 PM (in response to tony.herstell1)Thanks. Worked perfectly.
-
3. Re: One way of doing things?
tony.herstell1 Dec 23, 2006 1:28 PM (in response to tony.herstell1)You only have one message to override.
This presents a small porblem when you have various regex expressions for various reasons.
I suppose the only way to have different messages for each "reason" is to write your own validators and set up messages for each.
http://jsffaq.com/Wiki.jsp?page=HowToCreateTheCustomValidator
If not then please advise. -
4. Re: One way of doing things?
hstang Dec 23, 2006 2:32 PM (in response to tony.herstell1)Use the message attribute of the annotation if you need something more specific for particular property.
e.g.
@Range(min = 1000, max=2000, message="Apartment number must be between {min} and {max})
private Integer apartmentNumber; -
5. Re: One way of doing things?
hstang Dec 23, 2006 2:34 PM (in response to tony.herstell1)Although if you insist to use resource bundles, then I don't have much of a clue, perhaps to write your Validator.
-
6. Re: One way of doing things?
tony.herstell1 Dec 23, 2006 3:06 PM (in response to tony.herstell1)Thanks for your help.