接口 ViewResolver

所有已知实现类:
AbstractCachingViewResolver, AbstractTemplateViewResolver, BeanNameViewResolver, ContentNegotiatingViewResolver, FreeMarkerViewResolver, GroovyMarkupViewResolver, InternalResourceViewResolver, ScriptTemplateViewResolver, ServletViewResolverComposite, UrlBasedViewResolver, ViewResolverComposite, XsltViewResolver

public interface ViewResolver
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.

从以下版本开始:
4.0 2022/1/29 11:12
作者:
Rod Johnson, Juergen Hoeller, Harry Yang
另请参阅:
  • 方法概要

    修饰符和类型
    方法
    说明
    resolveViewName(String viewName, Locale locale)
    Resolve the given view by name.
  • 方法详细资料

    • resolveViewName

      @Nullable 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).

      参数:
      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 null if not found (optional, to allow for ViewResolver chaining)
      抛出:
      Exception - if the view cannot be resolved (typically in case of problems creating an actual View object)