updated for 2.2.0

Apache Velocity#

ztemplates supports apache velocity as rendering engine. In fact the author favors it for its simplicity.


To use add the annotation @Renderer(ZVelocityRenderer.class) to your view pojo and create a file named the same as your render pojo but with ending '.vm' at the same location as the '.java'


Velocity is configured by adding the file /WEB-INF/velocity.properties to your webapp.

Here is a sample /WEB-INF/velocity.properties

resource.loader = classpath,file
classpath.resource.loader.class = org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
file.resource.loader.class = org.apache.velocity.runtime.resource.loader.FileResourceLoader


To aid rapid development there is a switch to disable velocity caching from a webapp context (you wont need to change any deployed file).

For example in tomcat add the following to your context.xml:

   <Parameter name="ztemplates.velocity.nocache" value="true"/>

You will need this if you want to use a tool like JRebel and you don't want to disable caching in velocity.properties so it will not get accidentally deployed in production.

Neuen Anhang hinzuf�gen

Du bist nicht autorisiert, Anh�nge zu dieser Seite hochzuladen.
« Diese Seite (Version-) wurde zuletzt am 29-Dez-2011 11:26 von gerdziegler.de ge�ndert.