Installing the Velocity dispatcher
- Add the following line to your /WEB-INF/dispatcher.properties file.
- In the above configuration, Velocity templates will be associated with the .vm file extension.
- You may then add templates to an individual blog's /WEB-INF/(blog-id)/templates directory that use Velocity.
- You must restart your server if you are adding the Velocity dispatcher while blojsom is running.
Configuring the Velocity dispatcher
The Velocity dispatcher is configured by configuring Velocity. The Velocity configuration file is specified in the following initialization parameter for the blojsom servlet in /WEB-INF/web.xml.
The default velocity.properties file that comes with blojsom is given below. You may refer to the Velocity developer's guide
for the details on configuring Velocity. blojsom, by default, uses Velocity's file resource loader which loads Velocity templates from disk.
Configuring a flavor template to use the Velocity dispatcher
You can configure individual flavors to use the Velocity dispatcher by changing the properties in your /WEB-INF/(blog-id)/flavor.properties file. For example:
html=html.vm, text/html;charset=UTF-8
This line in the flavor.properties file configures the html flavor to use the html.vm template, where in the standard blojsom installation, templates with a .vm extension are associated with the Velocity dispatcher.
Writing templates using Velocity
Take a look at the Velocity templates that come with the blojsom installation. You may refer to the Velocity user's guide
for all the details on the syntax of writing templates using Velocity.