public class BeanNameViewResolver extends org.springframework.web.context.support.WebApplicationObjectSupport implements ViewResolver, org.springframework.core.Ordered
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
or in a corresponding configuration class.
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.
UrlBasedViewResolver| Constructor and Description |
|---|
BeanNameViewResolver() |
| Modifier and Type | Method and Description |
|---|---|
int |
getOrder() |
View |
resolveViewName(String viewName,
Locale locale)
Resolve the given view by name.
|
void |
setOrder(int order)
Specify the order value for this ViewResolver bean.
|
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContextpublic void setOrder(int order)
The default value is Ordered.LOWEST_PRECEDENCE, meaning non-ordered.
Ordered.getOrder()public int getOrder()
getOrder in interface org.springframework.core.Ordered@Nullable public View resolveViewName(String viewName, Locale locale) throws org.springframework.beans.BeansException
ViewResolverNote: 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).
resolveViewName in interface ViewResolverviewName - name of the view to resolvelocale - the Locale in which to resolve the view.
ViewResolvers that support internationalization should respect this.null if not found
(optional, to allow for ViewResolver chaining)org.springframework.beans.BeansException