类 BeanNameViewResolver
- java.lang.Object
- org.springframework.context.support.ApplicationObjectSupport
- org.springframework.web.context.support.WebApplicationObjectSupport
- org.springframework.web.servlet.view.BeanNameViewResolver
 
 
 
- 所有已实现的接口:
- Aware,- ApplicationContextAware,- Ordered,- ServletContextAware,- ViewResolver
 - public class BeanNameViewResolver extends WebApplicationObjectSupport implements ViewResolver, Ordered A simple implementation of- ViewResolverthat 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, - XmlViewResolverwill be the better choice, as it separates the XML view bean definitions into a dedicated views file.- Note: Neither this - ViewResolvernor- XmlViewResolversupports internationalization. Consider- ResourceBundleViewResolverif you need to apply different view resources per locale.- Note: This - ViewResolverimplements the- Orderedinterface in order to allow for flexible participation in- ViewResolverchaining. 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.- 从以下版本开始:
- 18.06.2003
- 作者:
- Juergen Hoeller
- 另请参阅:
- XmlViewResolver,- ResourceBundleViewResolver,- UrlBasedViewResolver
 
- 字段概要- 从类继承的字段 org.springframework.context.support.ApplicationObjectSupport- logger
 - 从接口继承的字段 org.springframework.core.Ordered- HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
 - 构造器概要- 构造器 - 构造器 - 说明 - BeanNameViewResolver()
 - 方法概要- 所有方法 实例方法 具体方法 - 修饰符和类型 - 方法 - 说明 - int- getOrder()Get the order value of this object.- View- resolveViewName(String viewName, Locale locale)Resolve the given view by name.- void- setOrder(int order)Specify the order value for this ViewResolver bean.- 从类继承的方法 org.springframework.web.context.support.WebApplicationObjectSupport- getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
 - 从类继承的方法 org.springframework.context.support.ApplicationObjectSupport- getApplicationContext, getMessageSourceAccessor, initApplicationContext, obtainApplicationContext, requiredContextClass, setApplicationContext
 
 
- 构造器详细资料- BeanNameViewResolver- public BeanNameViewResolver() 
 
 - 方法详细资料- setOrder- public void setOrder(int order) Specify the order value for this ViewResolver bean.- The default value is - Ordered.LOWEST_PRECEDENCE, meaning non-ordered.- 另请参阅:
- Ordered.getOrder()
 
 - getOrder- public int getOrder() 从接口复制的说明:- OrderedGet the order value of this object.- Higher values are interpreted as lower priority. As a consequence, the object with the lowest value has the highest priority (somewhat analogous to Servlet - load-on-startupvalues).- Same order values will result in arbitrary sort positions for the affected objects. - 指定者:
- getOrder在接口中- Ordered
- 返回:
- the order value
- 另请参阅:
- Ordered.HIGHEST_PRECEDENCE,- Ordered.LOWEST_PRECEDENCE
 
 - resolveViewName- @Nullable public View resolveViewName(String viewName, Locale locale) throws BeansException 从接口复制的说明:- ViewResolverResolve the given view by name.- Note: To allow for ViewResolver chaining, a ViewResolver should return - nullif 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在接口中- ViewResolver
- 参数:
- viewName- name of the view to resolve
- locale- the Locale in which to resolve the view. ViewResolvers that support internationalization should respect this.
- 返回:
- the View object, or nullif not found (optional, to allow for ViewResolver chaining)
- 抛出:
- BeansException