Spring 4 MVC View Resolvers

Topics 

  • Resolving views 
  • Spring-provided view resolvers 
  • Chaining view resolvers 
  • ViewController & RedirectViewController 
  • ContentNegotiatingViewResolver

Resolving Views 

  • All handler methods in a controller must resolve to a logical view name 
    • Explicitly (by returning a String, View, or ModelAndView) or 
    • Implicitly (void return type) 
  • A logical view name is then resolved by a view resolver 
    • “Resolving a view” means creating an appropriate View object 
    • Spring MVC goes through a series of view resolvers (in sequence) until it find a view resolver which can handle the logical view name 
    • Each view resolver returns a View object if it can handle it or null otherwise - if null returns, next view resolver is consulted 
  • Spring comes with a set of view resolvers 
    • Every view resolver implements ViewResolver interface View resolveViewName(String viewName, Locale locale)

You must have an active subscription to download PDF and Lab Zip of this course topic.Please click the "Subscribe" button or the "Login" button if you already have an account.