I want to maintain length of contact number(Like mobile number in between 10 and 12 digits number ). When I used String type I got but it allows alphabets along with numbers also. I want to prevent alphabets. How can I do with integer.
Below is my code:
@StringLengthFieldValidator(type=ValidatorType.FIELD,message="contact should contain min
of 10 numbers and max 12 numbers",minLength="10",maxLength="12")
private String contact;
Now I want for Integer type to do the same as above. How can I do
@ ?
private int contact;
You can do it with regex field validator. It validates numbers against the given pattern.