org.springframework.web.servlet.view.velocity
Class VelocityViewResolver

java.lang.Object
  extended byorg.springframework.context.support.ApplicationObjectSupport
      extended byorg.springframework.web.context.support.WebApplicationObjectSupport
          extended byorg.springframework.web.servlet.view.AbstractCachingViewResolver
              extended byorg.springframework.web.servlet.view.UrlBasedViewResolver
                  extended byorg.springframework.web.servlet.view.velocity.VelocityViewResolver
All Implemented Interfaces:
ApplicationContextAware, ViewResolver

public class VelocityViewResolver
extends UrlBasedViewResolver

Convenience subclass of UrlBasedViewResolver that supports VelocityView (i.e. Velocity templates) and custom subclasses of it.

The view class for all views generated by this resolver can be specified via setViewClass. See UrlBasedViewResolver's javadocs for details.

Since:
13.12.2003
Author:
Juergen Hoeller
See Also:
UrlBasedViewResolver.setViewClass(java.lang.Class), UrlBasedViewResolver.setPrefix(java.lang.String), UrlBasedViewResolver.setSuffix(java.lang.String), UrlBasedViewResolver.setRequestContextAttribute(java.lang.String), setVelocityFormatterAttribute(java.lang.String), setDateToolAttribute(java.lang.String), setNumberToolAttribute(java.lang.String), VelocityView

Field Summary
 
Fields inherited from class org.springframework.context.support.ApplicationObjectSupport
logger
 
Constructor Summary
VelocityViewResolver()
          Sets default viewClass to VelocityView.
 
Method Summary
protected  View loadView(java.lang.String viewName, java.util.Locale locale)
          Subclasses must implement this method.
protected  java.lang.Class requiredViewClass()
          Requires VelocityView.
 void setDateToolAttribute(java.lang.String dateToolAttribute)
          Set the name of the DateTool helper object to expose in the Velocity context of this view, or null if not needed.
 void setNumberToolAttribute(java.lang.String numberToolAttribute)
          Set the name of the NumberTool helper object to expose in the Velocity context of this view, or null if not needed.
 void setVelocityFormatterAttribute(java.lang.String velocityFormatterAttribute)
          Set the name of the VelocityFormatter helper object to expose in the Velocity context of this view, or null if not needed.
 
Methods inherited from class org.springframework.web.servlet.view.UrlBasedViewResolver
getCacheKey, setContentType, setPrefix, setRequestContextAttribute, setSuffix, setViewClass
 
Methods inherited from class org.springframework.web.servlet.view.AbstractCachingViewResolver
isCache, resolveViewName, setCache
 
Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport
getServletContext, getTempDir, getWebApplicationContext, requiredContextClass
 
Methods inherited from class org.springframework.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, initApplicationContext, setApplicationContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VelocityViewResolver

public VelocityViewResolver()
Sets default viewClass to VelocityView.

See Also:
UrlBasedViewResolver.setViewClass(java.lang.Class)
Method Detail

requiredViewClass

protected java.lang.Class requiredViewClass()
Requires VelocityView.

Overrides:
requiredViewClass in class UrlBasedViewResolver
See Also:
VelocityView

setVelocityFormatterAttribute

public void setVelocityFormatterAttribute(java.lang.String velocityFormatterAttribute)
Set the name of the VelocityFormatter helper object to expose in the Velocity context of this view, or null if not needed. VelocityFormatter is part of the standard Velocity distribution.

See Also:
VelocityFormatter

setDateToolAttribute

public void setDateToolAttribute(java.lang.String dateToolAttribute)
Set the name of the DateTool helper object to expose in the Velocity context of this view, or null if not needed. DateTool is part of Velocity Tools 1.0.

See Also:
DateTool

setNumberToolAttribute

public void setNumberToolAttribute(java.lang.String numberToolAttribute)
Set the name of the NumberTool helper object to expose in the Velocity context of this view, or null if not needed. NumberTool is part of Velocity Tools 1.1.

See Also:
NumberTool

loadView

protected View loadView(java.lang.String viewName,
                        java.util.Locale locale)
Description copied from class: AbstractCachingViewResolver
Subclasses must implement this method. There need be no concern for efficiency, as this class will cache views. Not all subclasses may support internationalization: A subclass that doesn't can simply ignore the locale parameter.

Overrides:
loadView in class UrlBasedViewResolver


Copyright (C) 2003-2004 The Spring Framework Project.