spring-framework / org.springframework.web.bind

Package org.springframework.web.bind

Types

EscapedErrors

open class EscapedErrors : Errors

Errors wrapper that adds automatic HTML escaping to the wrapped instance, for convenient usage in HTML views. Can be retrieved easily via RequestContext's getErrors method.

Note that BindTag does not use this class to avoid unnecessary creation of ObjectError instances. It just escapes the messages and values that get copied into the respective BindStatus instance.

ServletRequestDataBinder

open class ServletRequestDataBinder : WebDataBinder

Special org.springframework.validation.DataBinder to perform data binding from servlet request parameters to JavaBeans, including support for multipart files.

See the DataBinder/WebDataBinder superclasses for customization options, which include specifying allowed/required fields, and registering custom property editors.

Can also be used for manual data binding in custom web controllers: for example, in a plain Controller implementation or in a MultiActionController handler method. Simply instantiate a ServletRequestDataBinder for each binding process, and invoke bind with the current ServletRequest as argument:

 MyBean myBean = new MyBean(); // apply binder to custom target object ServletRequestDataBinder binder = new ServletRequestDataBinder(myBean); // register custom editors, if desired binder.registerCustomEditor(...); // trigger actual binding of request parameters binder.bind(request); // optionally evaluate binding errors Errors errors = binder.getErrors(); ...

ServletRequestParameterPropertyValues

open class ServletRequestParameterPropertyValues : MutablePropertyValues

PropertyValues implementation created from parameters in a ServletRequest. Can look for all property values beginning with a certain prefix and prefix separator (default is "_").

For example, with a prefix of "spring", "spring_param1" and "spring_param2" result in a Map with "param1" and "param2" as keys.

This class is not immutable to be able to efficiently remove property values that should be ignored for binding.

ServletRequestUtils

abstract class ServletRequestUtils

Parameter extraction methods, for an approach distinct from data binding, in which parameters of specific types are required.

This approach is very useful for simple submissions, where binding request parameters to a command object would be overkill.

Exceptions

MethodArgumentNotValidException

open class MethodArgumentNotValidException : Exception

Exception to be thrown when validation on an argument annotated with @Valid fails.

MissingPathVariableException

open class MissingPathVariableException : ServletRequestBindingException

ServletRequestBindingException subclass that indicates that a path variable expected in the method parameters of an @RequestMapping method is not present among the URI variables extracted from the URL. Typically that means the URI template does not match the path variable name declared on the method parameter.

MissingServletRequestParameterException

open class MissingServletRequestParameterException : ServletRequestBindingException

ServletRequestBindingException subclass that indicates a missing parameter.

UnsatisfiedServletRequestParameterException

open class UnsatisfiedServletRequestParameterException : ServletRequestBindingException

ServletRequestBindingException subclass that indicates an unsatisfied parameter condition, as typically expressed using an @RequestMapping annotation at the @Controller type level.