接口的使用
org.springframework.validation.Errors
使用Errors的程序包 程序包 说明 org.springframework.validation Provides data binding and validation functionality, for usage in business and/or UI layers.org.springframework.validation.beanvalidation Support classes for integrating a JSR-303 Bean Validation provider (such as Hibernate Validator) into a Spring ApplicationContext and in particular with Spring's data binding and validation APIs.org.springframework.web.bind Provides web-specific data binding functionality.org.springframework.web.bind.support Support classes for web data binding.org.springframework.web.reactive.result.view Support for result handling through view resolution.org.springframework.web.servlet.support Support classes for Spring's web MVC framework.org.springframework.web.servlet.tags This package contains Spring's JSP standard tag library for JSP 2.0+.org.springframework.validation中Errors的使用
org.springframework.validation中Errors的子接口 修饰符和类型 接口 说明 interfaceBindingResultGeneral interface that represents binding results.实现Errors的org.springframework.validation中的类 修饰符和类型 类 说明 classAbstractBindingResultAbstract implementation of theBindingResultinterface and its super-interfaceErrors.classAbstractErrorsAbstract implementation of theErrorsinterface.classAbstractPropertyBindingResultAbstract base class forBindingResultimplementations that work with Spring'sPropertyAccessormechanism.classBeanPropertyBindingResultDefault implementation of theErrorsandBindingResultinterfaces, for the registration and evaluation of binding errors on JavaBean objects.classBindExceptionThrown when binding errors are considered fatal.classDirectFieldBindingResultSpecial implementation of the Errors and BindingResult interfaces, supporting registration and evaluation of binding errors on value objects.classMapBindingResultMap-based implementation of the BindingResult interface, supporting registration and evaluation of binding errors on Map attributes.参数类型为Errors的org.springframework.validation中的方法 修饰符和类型 方法 说明 voidAbstractBindingResult. addAllErrors(Errors errors)voidBindException. addAllErrors(Errors errors)voidErrors. addAllErrors(Errors errors)Add all errors from the givenErrorsinstance to thisErrorsinstance.static voidValidationUtils. invokeValidator(Validator validator, Object target, Errors errors)static voidValidationUtils. invokeValidator(Validator validator, Object target, Errors errors, Object... validationHints)static voidValidationUtils. rejectIfEmpty(Errors errors, String field, String errorCode)Reject the given field with the given error code if the value is empty.static voidValidationUtils. rejectIfEmpty(Errors errors, String field, String errorCode, Object[] errorArgs)Reject the given field with the given error code and error arguments if the value is empty.static voidValidationUtils. rejectIfEmpty(Errors errors, String field, String errorCode, Object[] errorArgs, String defaultMessage)Reject the given field with the given error code, error arguments and default message if the value is empty.static voidValidationUtils. rejectIfEmpty(Errors errors, String field, String errorCode, String defaultMessage)Reject the given field with the given error code and default message if the value is empty.static voidValidationUtils. rejectIfEmptyOrWhitespace(Errors errors, String field, String errorCode)Reject the given field with the given error code if the value is empty or just contains whitespace.static voidValidationUtils. rejectIfEmptyOrWhitespace(Errors errors, String field, String errorCode, Object[] errorArgs)Reject the given field with the given error code and error arguments if the value is empty or just contains whitespace.static voidValidationUtils. rejectIfEmptyOrWhitespace(Errors errors, String field, String errorCode, Object[] errorArgs, String defaultMessage)Reject the given field with the given error code, error arguments and default message if the value is empty or just contains whitespace.static voidValidationUtils. rejectIfEmptyOrWhitespace(Errors errors, String field, String errorCode, String defaultMessage)Reject the given field with the given error code and default message if the value is empty or just contains whitespace.voidSmartValidator. validate(Object target, Errors errors, Object... validationHints)Validate the suppliedtargetobject, which must be of a type ofClassfor which theValidator.supports(Class)method typically returnstrue.voidValidator. validate(Object target, Errors errors)Validate the suppliedtargetobject, which must be of aClassfor which theValidator.supports(Class)method typically has (or would) returntrue.default voidSmartValidator. validateValue(Class<?> targetType, String fieldName, Object value, Errors errors, Object... validationHints)Validate the supplied value for the specified field on the target type, reporting the same validation errors as if the value would be bound to the field on an instance of the target class.org.springframework.validation.beanvalidation中Errors的使用
参数类型为Errors的org.springframework.validation.beanvalidation中的方法 修饰符和类型 方法 说明 protected voidSpringValidatorAdapter. processConstraintViolations(Set<ConstraintViolation<Object>> violations, Errors errors)Process the given JSR-303 ConstraintViolations, adding corresponding errors to the provided SpringErrorsobject.voidSpringValidatorAdapter. validate(Object target, Errors errors)voidSpringValidatorAdapter. validate(Object target, Errors errors, Object... validationHints)voidSpringValidatorAdapter. validateValue(Class<?> targetType, String fieldName, Object value, Errors errors, Object... validationHints)org.springframework.web.bind中Errors的使用
实现Errors的org.springframework.web.bind中的类 修饰符和类型 类 说明 classEscapedErrorsErrors wrapper that adds automatic HTML escaping to the wrapped instance, for convenient usage in HTML views.返回Errors的org.springframework.web.bind中的方法 修饰符和类型 方法 说明 ErrorsEscapedErrors. getSource()参数类型为Errors的org.springframework.web.bind中的方法 修饰符和类型 方法 说明 voidEscapedErrors. addAllErrors(Errors errors)参数类型为Errors的org.springframework.web.bind中的构造器 构造器 说明 EscapedErrors(Errors source)Create a new EscapedErrors instance for the given source instance.org.springframework.web.bind.support中Errors的使用
实现Errors的org.springframework.web.bind.support中的类 修饰符和类型 类 说明 classWebExchangeBindExceptionA specialization ofServerWebInputExceptionthrown when after data binding and validation failure.参数类型为Errors的org.springframework.web.bind.support中的方法 修饰符和类型 方法 说明 voidWebExchangeBindException. addAllErrors(Errors errors)org.springframework.web.reactive.result.view中Errors的使用
返回Errors的org.springframework.web.reactive.result.view中的方法 修饰符和类型 方法 说明 ErrorsBindStatus. getErrors()Return the Errors instance (typically a BindingResult) that this bind status is currently associated with.ErrorsRequestContext. getErrors(String name)Retrieve the Errors instance for the given bind object, using the "defaultHtmlEscape" setting.ErrorsRequestContext. getErrors(String name, boolean htmlEscape)Retrieve the Errors instance for the given bind object.org.springframework.web.servlet.support中Errors的使用
返回Errors的org.springframework.web.servlet.support中的方法 修饰符和类型 方法 说明 ErrorsBindStatus. getErrors()Return the Errors instance (typically a BindingResult) that this bind status is currently associated with.ErrorsRequestContext. getErrors(String name)Retrieve the Errors instance for the given bind object, using the "defaultHtmlEscape" setting.ErrorsRequestContext. getErrors(String name, boolean htmlEscape)Retrieve the Errors instance for the given bind object.org.springframework.web.servlet.tags中Errors的使用