Top Description Methods
org.springframework.web.servlet

public Interface ViewResolver

Known Direct Implementers
org.springframework.web.servlet.view.AbstractCachingViewResolver, org.springframework.web.servlet.view.BeanNameViewResolver, org.springframework.web.servlet.view.ContentNegotiatingViewResolver, org.springframework.web.servlet.view.ViewResolverComposite
Imports
java.util.Locale, org.springframework.lang.Nullable

Interface to be implemented by objects that can resolve views by name.

View state doesn't change during the running of the application, so implementations are free to cache views.

Implementations are encouraged to support internationalization, i.e. localized view resolution.

Authors
Rod Johnson, Juergen Hoeller
See Also
org.springframework.web.servlet.view.InternalResourceViewResolver, org.springframework.web.servlet.view.ContentNegotiatingViewResolver, org.springframework.web.servlet.view.BeanNameViewResolver

Method Summary

Modifier and TypeMethod and Description
public View

Returns:

the View object, or null if not found (optional, to allow for ViewResolver chaining)
resolveViewName
(String
name of the view to resolve
viewName
,
Locale
the Locale in which to resolve the view. ViewResolvers that support internationalization should respect this.
locale
)

Resolve the given view by name.

Method Detail

resolveViewNameback to summary
public View resolveViewName(String viewName, Locale locale) throws Exception

Resolve the given view by name.

Note

To allow for ViewResolver chaining, a ViewResolver should return null if a view with the given name is not defined in it. However, this is not required: Some ViewResolvers will always attempt to build View objects with the given name, unable to return null (rather throwing an exception when View creation failed).

Parameters
viewName:String

name of the view to resolve

locale:Locale

the Locale in which to resolve the view. ViewResolvers that support internationalization should respect this.

Returns:View

the View object, or null if not found (optional, to allow for ViewResolver chaining)

Annotations
@Nullable
Exceptions
Exception:
if the view cannot be resolved (typically in case of problems creating an actual View object)