spring-framework / org.springframework.web.servlet.view / BeanNameViewResolver

BeanNameViewResolver

open class BeanNameViewResolver : WebApplicationObjectSupport, ViewResolver, Ordered

A simple implementation of org.springframework.web.servlet.ViewResolver that interprets a view name as a bean name in the current application context, i.e. typically in the XML file of the executing DispatcherServlet.

This resolver can be handy for small applications, keeping all definitions ranging from controllers to views in the same place. For larger applications, XmlViewResolver will be the better choice, as it separates the XML view bean definitions into a dedicated views file.

Note: Neither this ViewResolver nor XmlViewResolver supports internationalization. Consider ResourceBundleViewResolver if you need to apply different view resources per locale.

Note: This ViewResolver implements the Ordered interface in order to allow for flexible participation in ViewResolver chaining. For example, some special views could be defined via this ViewResolver (giving it 0 as "order" value), while all remaining views could be resolved by a UrlBasedViewResolver.

Author
Juergen Hoeller

Since
18.06.2003

See Also
XmlViewResolverResourceBundleViewResolverUrlBasedViewResolver

Constructors

<init>

BeanNameViewResolver()

A simple implementation of org.springframework.web.servlet.ViewResolver that interprets a view name as a bean name in the current application context, i.e. typically in the XML file of the executing DispatcherServlet.

This resolver can be handy for small applications, keeping all definitions ranging from controllers to views in the same place. For larger applications, XmlViewResolver will be the better choice, as it separates the XML view bean definitions into a dedicated views file.

Note: Neither this ViewResolver nor XmlViewResolver supports internationalization. Consider ResourceBundleViewResolver if you need to apply different view resources per locale.

Note: This ViewResolver implements the Ordered interface in order to allow for flexible participation in ViewResolver chaining. For example, some special views could be defined via this ViewResolver (giving it 0 as "order" value), while all remaining views could be resolved by a UrlBasedViewResolver.

Functions

getOrder

open fun getOrder(): Int

resolveViewName

open fun resolveViewName(viewName: String, locale: Locale): View

setOrder

open fun setOrder(order: Int): Unit