235236237238239240241242243244245
context, value, this.getParameters(), errors, this.validatorAction, field }); if (!errors.isEmpty()) { throw new ValidatorException(new FacesMessage( FacesMessage.SEVERITY_ERROR, (String)errors.iterator().next(), null)); } }
495051525354555657
log.debug("response is not valid, initializing with new challenge"); captcha.init(); FacesMessage msg = new FacesMessage(); msg.setSummary(Interpolator.instance().interpolate(VERIFICATION_MSG_EXPR)); msg.setSeverity(FacesMessage.SEVERITY_WARN); throw new ValidatorException(msg); } log.debug("response is valid"); }
3334353637383940
FacesMessage facesMessage = new FacesMessage(); facesMessage.setSummary("Member Id is not valid."); facesMessage.setDetail("Member Id must be an positive number."); facesMessage.setSeverity(FacesMessage.SEVERITY_ERROR); facesContext.addMessage("reg:id", facesMessage); throw new ValidatorException(facesMessage); } }
383940414243444546
FacesMessage facesMessage = new FacesMessage(); facesMessage.setSummary("Name is not valid."); facesMessage.setDetail("Name must contain only letters and spaces."); facesMessage.setSeverity(FacesMessage.SEVERITY_ERROR); facesContext.addMessage("reg:name", facesMessage); throw new ValidatorException(facesMessage); } }
434445464748495051
FacesMessage facesMessage = new FacesMessage(); facesMessage.setSummary("Email address is is not valid."); facesMessage.setDetail("Email address is not valid."); facesMessage.setSeverity(FacesMessage.SEVERITY_ERROR); facesContext.addMessage("reg:email", facesMessage); throw new ValidatorException(facesMessage); } }
244245246247248249250251252253254255256257
} catch (ELException ele) { Throwable cause = ele.getCause(); if (cause==null) cause = ele; throw new ValidatorException( createMessage(cause), cause ); } if ( invalidValues.length>0 ) { throw new ValidatorException( createMessage(invalidValues) ); } } }
267268269270271272273274275276277
} private void addRequiredMessage(FacesContext facesContext) { ResourceBundle resourceBundle = SeamResourceBundle.getBundle(); throw new ValidatorException( new FacesMessage( FacesMessage.SEVERITY_ERROR, resourceBundle.getString("javax.faces.component.UIInput.REQUIRED"), null ) ); }
1314151617181920
@Override public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException { if (value != null && value.toString().equals("invalid")) { throw new ValidatorException(new FacesMessage("Invalid")); } }
@Override public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException { if (value != null && value.toString().equals("invalid")) { throw new ValidatorException(new FacesMessage("Invalid value: " + value)); } }
2930313233343536
Date fromDate = (Date) component.getAttributes().get("departDate"); if (fromDate.after(toDate)) { FacesMessage message = new FacesMessage("Invalid dates submitted."); message.setSeverity(FacesMessage.SEVERITY_ERROR); throw new ValidatorException(message); } }