Wiele wzorców Regex @ dla 1 pola?
Podjęto próbę zastosowania wielu adnotacji @Pattern w jednym polu:
@Pattern(regexp = "(?=.*[0-9])", message = "Password must contain one digit.")
@Pattern(regexp = "(?=.*[a-z])", message = "Password must contain one lowercase letter.")
@Pattern(regexp = "(?=.*[A-Z])", message = "Password must contain one uppercase letter.")
@Pattern(regexp = "(?=\S+$)", message = "Password must contain no whitespace.")
private String password;
Jednak nie mogę tego zrobić. Chcę, aby pojedyncze wiadomości na każde naruszenie ograniczenia regex w polu hasła. czy to możliwe?
Moją alternatywą jest użycie tagów JSF 2.0 f: validatorRegex.