java.lang.Object | |||
↳ | org.springframework.context.support.ApplicationObjectSupport | ||
↳ | org.springframework.web.context.support.WebApplicationObjectSupport | ||
↳ | org.springframework.web.servlet.view.BeanNameViewResolver |
Simple implementation of ViewResolver that interprets a view name as bean name in the current application context, i.e. 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 normal applications, XmlViewResolver will be the better choice, as it separates the XML view bean definitions into a dedicated views file. View beans should virtually never have references to any other application beans - such a separation will make this clear.
This ViewResolver does not support internationalization. Conside ResourceBundleViewResolver if you need to apply different view resources per locale.
Note: This ViewResolver implements the Ordered interface 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.
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
org.springframework.core.Ordered
|
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.context.support.ApplicationObjectSupport
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Return the order value of this object, with a
higher value meaning greater in terms of sorting.
| |||||||||||
Resolve the given view by name.
| |||||||||||
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.web.context.support.WebApplicationObjectSupport
| |||||||||||
From class
org.springframework.context.support.ApplicationObjectSupport
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
org.springframework.context.ApplicationContextAware
| |||||||||||
From interface
org.springframework.core.Ordered
| |||||||||||
From interface
org.springframework.web.context.ServletContextAware
| |||||||||||
From interface
org.springframework.web.servlet.ViewResolver
|
Return the order value of this object, with a higher value meaning greater in terms of sorting.
Normally starting with 0, with Integer.MAX_VALUE
indicating the greatest value. Same order values will result
in arbitrary positions for the affected objects.
Higher values can be interpreted as lower priority. As a consequence, the object with the lowest value has highest priority (somewhat analogous to Servlet "load-on-startup" values).
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).
viewName | name of the view to resolve |
---|---|
locale | Locale in which to resolve the view. ViewResolvers that support internationalization should respect this. |
null
if not found
(optional, to allow for ViewResolver chaining)BeansException |
---|