org.springframework.web.servlet.view
Class ResourceBundleViewResolver

org.springframework.context.support.ApplicationObjectSupport
  |
  +--org.springframework.web.context.support.WebApplicationObjectSupport
        |
        +--org.springframework.web.servlet.view.AbstractCachingViewResolver
              |
              +--org.springframework.web.servlet.view.ResourceBundleViewResolver

public class ResourceBundleViewResolver
extends AbstractCachingViewResolver

Implementation of ViewResolver that uses bean definitions in a ResourceBundle, specified by the bundle basename. The bundle is typically defined in a properties file, located in the classpath.

This ViewResolver supports internationalization, using the default support of java.util.PropertyResourceBundle.

Extends AbstractCachingViewResolver for decent performance.

Author:
Rod Johnson, Juergen Hoeller
See Also: java.util.ResourceBundle.getBundle(java.lang.String), PropertyResourceBundle

Field Summary
 final static StringDEFAULT_BASENAME
          Default if no other basename is supplied

Method Summary
 voidsetBasename(String basename)
          Set the basename, as defined in the java.util.ResourceBundle documentation.
 voidsetDefaultParentView(String defaultParentView)
          Set the default parent for views defined in the ResourceBundle.

Methods inherited from class org.springframework.web.servlet.view.AbstractCachingViewResolver
isCache, resolveViewName, setCache

Methods inherited from class org.springframework.context.support.ApplicationObjectSupport
getApplicationContext, setApplicationContext

Field Detail

DEFAULT_BASENAME

public final static String DEFAULT_BASENAME
Default if no other basename is supplied
Method Detail

setBasename

public void setBasename(String basename)
Set the basename, as defined in the java.util.ResourceBundle documentation. ResourceBundle supports different suffixes. For example, a base name of "views" might map to ResourceBundle files "views", "views_en_au" and "views_de".

The default is "views".

Parameters:
basename - the ResourceBundle base name
See Also:
ResourceBundle

setDefaultParentView

public void setDefaultParentView(String defaultParentView)
Set the default parent for views defined in the ResourceBundle. This avoids repeated "yyy1.parent=xxx", "yyy2.parent=xxx" definitions in the bundle, especially if all defined views share the same parent. The parent will typically define the view class and common attributes. Concrete views might simply consist of an URL definition then: a la "yyy1.url=/my.jsp", "yyy2.url=/your.jsp".
Parameters:
defaultParentView - the default parent view

Association Links

to Class java.lang.String

Default if no other basename is supplied

to Class java.lang.String

to Class java.lang.String

to Class java.util.Map

Locale -> BeanFactory