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:
- url: location of the Velocity template to be wrapped,
relative to the Velocity resource loader path (see VelocityConfigurer).
- dateToolAttribute (optional, default=null): set the name of the
DateTool helper object to expose in the Velocity context of this view,
or null if not needed. DateTool is from Velocity Tools.
- cacheTemplate (optional, default=false): whether or not the Velocity
template should be cached. 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.
- writerPoolSize (optional, default=40): number of Velocity writers
(refer to Velocity documentation to see exactly what this means)
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
| Method Summary |
void | setCacheTemplate(boolean cacheTemplate) Set whether the Velocity template should be cached. |
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. |
void | setWriterPoolSize(int writerPoolSize) Set the number of Velocity writers. |
DEFAULT_WRITER_POOL_SIZE
public final static int DEFAULT_WRITER_POOL_SIZE
OUTPUT_BUFFER_SIZE
public final static int OUTPUT_BUFFER_SIZE
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.
to Class java.lang.String
to Class java.lang.String
- The encoding to use when generating outputing