Example #1
0
 public void validateGroupMessage(FacesContext context, UIComponent component, Object value) {
   String strValue = (String) value;
   if (StringUtils.isEmpty(strValue)) {
     UIComponent ui = component.findComponent("groupEmailRegexp");
     UIInput input = (UIInput) ui;
     if (!StringUtils.isEmpty((String) input.getValue())) {
       FacesMessage error = new FacesMessage();
       error.setSeverity(FacesMessage.SEVERITY_ERROR);
       error.setSummary("Поле обязательно для заполнения");
       throw new ValidatorException(error);
     }
   }
 }
Example #2
0
 public void validateGroupRegexp(FacesContext context, UIComponent component, Object value) {
   String strValue = (String) value;
   try {
     if (!StringUtils.isEmpty(strValue)) Pattern.compile(strValue);
   } catch (PatternSyntaxException e) {
     FacesMessage error = new FacesMessage();
     error.setSeverity(FacesMessage.SEVERITY_ERROR);
     error.setSummary("Не валидное regexp выражение");
     throw new ValidatorException(error);
   }
 }