Uses of Class
org.springframework.web.servlet.ModelAndView
Package
Description
Helper classes for unit tests based on Spring's web support.
Contains server-side support for testing Spring MVC applications.
Contains built-in
ResultMatcher
and ResultHandler
implementations.Provides servlets that integrate with the application context
infrastructure, and the core interfaces and classes for the
Spring web MVC framework.
Provides the types that make up Spring's functional web framework for Servlet environments.
Classes supporting the
org.springframework.web.servlet.function
package.Provides standard HandlerMapping implementations,
including abstract base classes for custom implementations.
Standard controller implementations for the Servlet MVC framework that comes with
Spring.
Support package for annotation-based Servlet MVC controllers.
Servlet-based infrastructure for handler method processing,
building on the
org.springframework.web.method
package.MVC infrastructure for annotation-based handler method processing, building on the
org.springframework.web.method.annotation
package.Support package for MVC controllers.
-
Uses of ModelAndView in org.springframework.test.web
Modifier and TypeMethodDescriptionstatic <T> T
ModelAndViewAssert.assertAndReturnModelAttributeOfType
(ModelAndView mav, String modelName, Class<T> expectedType) Checks whether the model value under the givenmodelName
exists and checks its type, based on theexpectedType
.static void
ModelAndViewAssert.assertCompareListModelAttribute
(ModelAndView mav, String modelName, List expectedList) Compare each individual entry in a list, without first sorting the lists.static void
ModelAndViewAssert.assertModelAttributeAvailable
(ModelAndView mav, String modelName) Assert whether a model attribute is available.static void
ModelAndViewAssert.assertModelAttributeValue
(ModelAndView mav, String modelName, Object expectedValue) Compare a givenexpectedValue
to the value from the model bound under the givenmodelName
.static void
ModelAndViewAssert.assertModelAttributeValues
(ModelAndView mav, Map<String, Object> expectedModel) Inspect theexpectedModel
to see if all elements in the model appear and are equal.static void
ModelAndViewAssert.assertSortAndCompareListModelAttribute
(ModelAndView mav, String modelName, List expectedList, Comparator comparator) Compare each individual entry in a list after having sorted both lists (optionally using a comparator).static void
ModelAndViewAssert.assertViewName
(ModelAndView mav, String expectedName) Check to see if the view name in the ModelAndView matches the givenexpectedName
. -
Uses of ModelAndView in org.springframework.test.web.servlet
Modifier and TypeMethodDescriptionMvcResult.getModelAndView()
Return theModelAndView
prepared by the handler. -
Uses of ModelAndView in org.springframework.test.web.servlet.result
Modifier and TypeMethodDescriptionprotected void
PrintingResultHandler.printModelAndView
(ModelAndView mav) Print the ModelAndView. -
Uses of ModelAndView in org.springframework.web.servlet
Modifier and TypeMethodDescriptionModelAndView.addAllObjects
(Map<String, ?> modelMap) Add all attributes contained in the provided Map to the model.Add an attribute to the model using parameter name generation.Add an attribute to the model.ModelAndViewDefiningException.getModelAndView()
Return the ModelAndView that this exception contains for forwarding to.HandlerAdapter.handle
(HttpServletRequest request, HttpServletResponse response, Object handler) Use the given handler to handle this request.protected ModelAndView
DispatcherServlet.processHandlerException
(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) Determine an error ModelAndView via the registered HandlerExceptionResolvers.HandlerExceptionResolver.resolveException
(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) Try to resolve the given exception that got thrown during handler execution, returning aModelAndView
that represents a specific error page if appropriate.Modifier and TypeMethodDescriptiondefault void
HandlerInterceptor.postHandle
(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) Interception point after successful execution of a handler.protected void
DispatcherServlet.render
(ModelAndView mv, HttpServletRequest request, HttpServletResponse response) Render the given ModelAndView.ModifierConstructorDescriptionModelAndViewDefiningException
(ModelAndView modelAndView) Create new ModelAndViewDefiningException with the given ModelAndView, typically representing a specific error page. -
Uses of ModelAndView in org.springframework.web.servlet.function
Modifier and TypeMethodDescriptionServerResponse.writeTo
(HttpServletRequest request, HttpServletResponse response, ServerResponse.Context context) Write this response to the given servlet response.Modifier and TypeMethodDescriptionServerResponse.HeadersBuilder.build
(BiFunction<HttpServletRequest, HttpServletResponse, ModelAndView> writeFunction) Build the response entity with a custom write function. -
Uses of ModelAndView in org.springframework.web.servlet.function.support
Modifier and TypeMethodDescriptionHandlerFunctionAdapter.handle
(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Object handler) -
Uses of ModelAndView in org.springframework.web.servlet.handler
Modifier and TypeMethodDescriptionprotected abstract ModelAndView
AbstractHandlerExceptionResolver.doResolveException
(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) Actually resolve the given exception that got thrown during handler execution, returning aModelAndView
that represents a specific error page if appropriate.protected final ModelAndView
AbstractHandlerMethodExceptionResolver.doResolveException
(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) protected ModelAndView
SimpleMappingExceptionResolver.doResolveException
(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) Actually resolve the given exception that got thrown during on handler execution, returning a ModelAndView that represents a specific error page if appropriate.protected abstract ModelAndView
AbstractHandlerMethodExceptionResolver.doResolveHandlerMethodException
(HttpServletRequest request, HttpServletResponse response, HandlerMethod handlerMethod, Exception ex) Actually resolve the given exception that got thrown during on handler execution, returning a ModelAndView that represents a specific error page if appropriate.protected ModelAndView
SimpleMappingExceptionResolver.getModelAndView
(String viewName, Exception ex) Return a ModelAndView for the given view name and exception.protected ModelAndView
SimpleMappingExceptionResolver.getModelAndView
(String viewName, Exception ex, HttpServletRequest request) Return a ModelAndView for the given request, view name and exception.SimpleServletHandlerAdapter.handle
(HttpServletRequest request, HttpServletResponse response, Object handler) AbstractHandlerExceptionResolver.resolveException
(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) Check whether this resolver is supposed to apply (i.e.HandlerExceptionResolverComposite.resolveException
(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) Resolve the exception by iterating over the list of configured exception resolvers.Modifier and TypeMethodDescriptionvoid
MappedInterceptor.postHandle
(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) void
WebRequestHandlerInterceptorAdapter.postHandle
(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) -
Uses of ModelAndView in org.springframework.web.servlet.mvc
Modifier and TypeMethodDescriptionHttpRequestHandlerAdapter.handle
(HttpServletRequest request, HttpServletResponse response, Object handler) SimpleControllerHandlerAdapter.handle
(HttpServletRequest request, HttpServletResponse response, Object handler) AbstractController.handleRequest
(HttpServletRequest request, HttpServletResponse response) Controller.handleRequest
(HttpServletRequest request, HttpServletResponse response) Process the request and return a ModelAndView object which the DispatcherServlet will render.protected abstract ModelAndView
AbstractController.handleRequestInternal
(HttpServletRequest request, HttpServletResponse response) Template method.protected ModelAndView
AbstractUrlViewController.handleRequestInternal
(HttpServletRequest request, HttpServletResponse response) Retrieves the URL path to use for lookup and delegates toAbstractUrlViewController.getViewNameForRequest(jakarta.servlet.http.HttpServletRequest)
.protected ModelAndView
ParameterizableViewController.handleRequestInternal
(HttpServletRequest request, HttpServletResponse response) Return a ModelAndView object with the specified view name.protected ModelAndView
ServletForwardingController.handleRequestInternal
(HttpServletRequest request, HttpServletResponse response) protected ModelAndView
ServletWrappingController.handleRequestInternal
(HttpServletRequest request, HttpServletResponse response) Invoke the wrapped Servlet instance.Modifier and TypeMethodDescriptionvoid
WebContentInterceptor.postHandle
(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) This implementation is empty. -
Uses of ModelAndView in org.springframework.web.servlet.mvc.annotation
Modifier and TypeFieldDescriptionstatic final ModelAndView
ModelAndViewResolver.UNRESOLVED
Marker to be returned when the resolver does not know how to handle the given method parameter.Modifier and TypeMethodDescriptionprotected ModelAndView
ResponseStatusExceptionResolver.applyStatusAndReason
(int statusCode, String reason, HttpServletResponse response) Apply the resolved status code and reason to the response.protected ModelAndView
ResponseStatusExceptionResolver.doResolveException
(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) ModelAndViewResolver.resolveModelAndView
(Method handlerMethod, Class<?> handlerType, Object returnValue, ExtendedModelMap implicitModel, NativeWebRequest webRequest) protected ModelAndView
ResponseStatusExceptionResolver.resolveResponseStatus
(ResponseStatus responseStatus, HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) Template method that handles the@ResponseStatus
annotation.protected ModelAndView
ResponseStatusExceptionResolver.resolveResponseStatusException
(ResponseStatusException ex, HttpServletRequest request, HttpServletResponse response, Object handler) Template method that handles anResponseStatusException
. -
Uses of ModelAndView in org.springframework.web.servlet.mvc.method
Modifier and TypeMethodDescriptionfinal ModelAndView
AbstractHandlerMethodAdapter.handle
(HttpServletRequest request, HttpServletResponse response, Object handler) This implementation expects the handler to be anHandlerMethod
.protected abstract ModelAndView
AbstractHandlerMethodAdapter.handleInternal
(HttpServletRequest request, HttpServletResponse response, HandlerMethod handlerMethod) Use the given handler method to handle the request. -
Uses of ModelAndView in org.springframework.web.servlet.mvc.method.annotation
Modifier and TypeMethodDescriptionprotected ModelAndView
ExceptionHandlerExceptionResolver.doResolveHandlerMethodException
(HttpServletRequest request, HttpServletResponse response, HandlerMethod handlerMethod, Exception exception) Find an@ExceptionHandler
method and invoke it to handle the raised exception.protected ModelAndView
RequestMappingHandlerAdapter.handleInternal
(HttpServletRequest request, HttpServletResponse response, HandlerMethod handlerMethod) protected ModelAndView
RequestMappingHandlerAdapter.invokeHandlerMethod
(HttpServletRequest request, HttpServletResponse response, HandlerMethod handlerMethod) Invoke theRequestMapping
handler method preparing aModelAndView
if view resolution is required. -
Uses of ModelAndView in org.springframework.web.servlet.mvc.support
Modifier and TypeMethodDescriptionprotected ModelAndView
DefaultHandlerExceptionResolver.doResolveException
(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) protected ModelAndView
DefaultHandlerExceptionResolver.handleAsyncRequestNotUsableException
(AsyncRequestNotUsableException ex, HttpServletRequest request, HttpServletResponse response, Object handler) Handle the case of an I/O failure from the ServletOutputStream.protected ModelAndView
DefaultHandlerExceptionResolver.handleAsyncRequestTimeoutException
(AsyncRequestTimeoutException ex, HttpServletRequest request, HttpServletResponse response, Object handler) Handle the case where an async request timed out.protected ModelAndView
DefaultHandlerExceptionResolver.handleBindException
(BindException ex, HttpServletRequest request, HttpServletResponse response, Object handler) Deprecated, for removal: This API element is subject to removal in a future version.protected ModelAndView
DefaultHandlerExceptionResolver.handleConversionNotSupported
(ConversionNotSupportedException ex, HttpServletRequest request, HttpServletResponse response, Object handler) Handle the case when aWebDataBinder
conversion cannot occur.protected ModelAndView
DefaultHandlerExceptionResolver.handleErrorResponse
(ErrorResponse errorResponse, HttpServletRequest request, HttpServletResponse response, Object handler) Handle anErrorResponse
exception.protected ModelAndView
DefaultHandlerExceptionResolver.handleHttpMediaTypeNotAcceptable
(HttpMediaTypeNotAcceptableException ex, HttpServletRequest request, HttpServletResponse response, Object handler) Handle the case where no message converters were found that were acceptable for the client (expressed via theAccept
header).protected ModelAndView
DefaultHandlerExceptionResolver.handleHttpMediaTypeNotSupported
(HttpMediaTypeNotSupportedException ex, HttpServletRequest request, HttpServletResponse response, Object handler) Handle the case where no message converters were found for PUT or POSTed content.protected ModelAndView
DefaultHandlerExceptionResolver.handleHttpMessageNotReadable
(HttpMessageNotReadableException ex, HttpServletRequest request, HttpServletResponse response, Object handler) Handle the case where a message converter cannot read from an HTTP request.protected ModelAndView
DefaultHandlerExceptionResolver.handleHttpMessageNotWritable
(HttpMessageNotWritableException ex, HttpServletRequest request, HttpServletResponse response, Object handler) Handle the case where a message converter cannot write to an HTTP response.protected ModelAndView
DefaultHandlerExceptionResolver.handleHttpRequestMethodNotSupported
(HttpRequestMethodNotSupportedException ex, HttpServletRequest request, HttpServletResponse response, Object handler) Handle the case where no handler was found for the HTTP method.protected ModelAndView
DefaultHandlerExceptionResolver.handleMethodArgumentNotValidException
(MethodArgumentNotValidException ex, HttpServletRequest request, HttpServletResponse response, Object handler) Handle the case where an argument annotated with@Valid
such as anRequestBody
orRequestPart
argument fails validation.protected ModelAndView
DefaultHandlerExceptionResolver.handleMissingPathVariable
(MissingPathVariableException ex, HttpServletRequest request, HttpServletResponse response, Object handler) Handle the case when a declared path variable does not match any extracted URI variable.protected ModelAndView
DefaultHandlerExceptionResolver.handleMissingServletRequestParameter
(MissingServletRequestParameterException ex, HttpServletRequest request, HttpServletResponse response, Object handler) Handle the case when a required parameter is missing.protected ModelAndView
DefaultHandlerExceptionResolver.handleMissingServletRequestPartException
(MissingServletRequestPartException ex, HttpServletRequest request, HttpServletResponse response, Object handler) Handle the case where an @RequestPart, aMultipartFile
, or ajakarta.servlet.http.Part
argument is required but is missing.protected ModelAndView
DefaultHandlerExceptionResolver.handleNoHandlerFoundException
(NoHandlerFoundException ex, HttpServletRequest request, HttpServletResponse response, Object handler) Handle the case where no handler was found during the dispatch.protected ModelAndView
DefaultHandlerExceptionResolver.handleServletRequestBindingException
(ServletRequestBindingException ex, HttpServletRequest request, HttpServletResponse response, Object handler) Handle the case when an unrecoverable binding exception occurs - e.g.protected ModelAndView
DefaultHandlerExceptionResolver.handleTypeMismatch
(TypeMismatchException ex, HttpServletRequest request, HttpServletResponse response, Object handler) Handle the case when aWebDataBinder
conversion error occurs.
ModelAttributeMethodProcessor
now raises theMethodArgumentNotValidException
subclass instead.