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

org.springframework.context.support.ApplicationObjectSupport
  |
  +--org.springframework.web.context.support.WebApplicationObjectSupport
        |
        +--org.springframework.web.servlet.view.AbstractView
              |
              +--org.springframework.web.servlet.view.AbstractUrlBasedView
                    |
                    +--org.springframework.web.servlet.view.velocity.VelocityView

public class VelocityView
extends AbstractUrlBasedView

View using Velocity template engine. Based on code in the VelocityServlet shipped with Velocity.

Exposes the following JavaBean properties:

Depends on a VelocityConfig object such as VelocityConfigurer being accessible in the current web application context.

Author:
Rod Johnson
Version: $Id: VelocityView.java,v 1.19 2004/02/07 00:18:32 jhoeller Exp $
See Also: VelocityConfig, VelocityConfigurer

Field Summary
 final static intDEFAULT_WRITER_POOL_SIZE
           
 final static intOUTPUT_BUFFER_SIZE
           

Method Summary
 voidsetCacheTemplate(boolean cacheTemplate)
          Set whether the Velocity template should be cached.
 voidsetDateToolAttribute(String dateToolAttribute)
          Set the name of the DateHool helper object to expose in the Velocity context of this view, or null if not needed.
 voidsetWriterPoolSize(int writerPoolSize)
          Set the number of Velocity writers.

Methods inherited from class org.springframework.web.servlet.view.AbstractUrlBasedView
getUrl, setUrl

Methods inherited from class org.springframework.web.servlet.view.AbstractView
addStaticAttribute, getBeanName, getStaticAttributes, render, setAttributes, setAttributesCSV, setAttributesMap, setBeanName, setContentType, setRequestContextAttribute

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

Field Detail

DEFAULT_WRITER_POOL_SIZE

public final static int DEFAULT_WRITER_POOL_SIZE

OUTPUT_BUFFER_SIZE

public final static int OUTPUT_BUFFER_SIZE
Method Detail

setCacheTemplate

public void setCacheTemplate(boolean cacheTemplate)
Set whether the Velocity template should be cached. Default is false. It should normally be true in production, but setting this to false enables us to modify Velocity templates without restarting the application (similar to JSPs).

Note that this is a minor optimization only, as Velocity itself caches templates in a modification-aware fashion.


setDateToolAttribute

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

setWriterPoolSize

public void setWriterPoolSize(int writerPoolSize)
Set the number of Velocity writers. Default is 40. Refer to Velocity documentation to see exactly what this means.

Association Links

to Class java.lang.String

to Class java.lang.String

The encoding to use when generating outputing