判断richfaces本次请求是否验证错误

@Name("validatorError")
@Scope(ScopeType.EVENT)
@BypassInterceptors
public class ValidatorError {

    /**
     * isInvalid.
     * @return boolean
     */
    public boolean isInvalid() {
        Iterator<FacesMessage> iterator = FacesContext.getCurrentInstance()
                .getMessages();
        while (iterator.hasNext()) {
            FacesMessage facesMessage = iterator.next();
            if (FacesMessage.SEVERITY_ERROR.equals(facesMessage.getSeverity())) {
                return true;
            }
        }
        return false;
    }
}

 

你可能感兴趣的:(FacesMessage)