I am using org.hibernate.validator.Pattern
annotation in my jsf
managed bean to validate an <h:inputText>
component.
@Pattern(regex="\\W+")
public String getText() {
return text;
}
My question is, is there a way to get the regular expression from a method or EL withought hard-coding it.
For an example
@Pattern(regex = getRexEx())
OR
@Pattern(regex = "#{bean.regEx}")
I googled and found that the regEx
should be a constant. However there can be a alternative way to accomplish this.