Here's the code:
SomeFile.properties
string.regex="someRegex"
SomeActionClass.java
@Value("${string.regex}")
private String REGEX="";
@Validate(mask = REGEX)
private String stringToValidate;
The file SomeFile.properties is loaded on server startup and the value "someRegex" is stored somewhere in the session, so it is available.
The problem is that mask requires a constant value, and if I put final at REGEX="" I cannot overwrite the init value with the string.regex one; on the other hand if I put final but do not initialize the variable, java compiler complain about it.
Is there a way to use mask option with a value retrieved from file that I do not know?
Is it possible to do this directly on a jsp in a smart way, since I've have several fields to validate and I do not want to perform a check and write a message error for each one?