Heyall,
While using Struts2, I am using several annotations to do my validations inside the Model class, in the set()
methods, like:
@RequiredStringValidator(message = "Name is required")
@StringLengthFieldValidator(message = "Name must be between 5 and 60 characters",
minLength = "5", maxLength = "60")
public void setName(String name) {
this.name = name;
}
But I would like how to put a validation do avoid Strange characters, like !
, ?
, #
, $
and etc...
Is there any existing validator I should use like a @RestrictChars
or maybe is there some way to use the @StringRegexValidator
. Or should I write a new one. Any hint or documentation how to do such would be great.
Thanks in advance