FreeMarker
is an alternative presentation technology to either JSP or Velocity.
Installing the FreeMarker dispatcher
You must download the blojsom add-on bundle. It is available as a separate download
with each release of blojsom.
- Unpack the add-on bundle ZIP file.
- Copy the freemarker-2.3.jar to your blojsom installation's /WEB-INF/lib directory.
- Add the following line to your /WEB-INF/dispatcher.properties file.
- In the above configuration, FreeMarker templates will be associated with the .ftl file extension.
- You may then add templates to an individual blog's /WEB-INF/(blog-id)/templates directory that use FreeMarker.
- You must restart your server if you are adding the FreeMarker dispatcher while blojsom is running.
Configuring the FreeMarker dispatcher
The FreeMarker dispatcher is configured by configuring FreeMarker. The FreeMarker configuration file is specified in the following initialization parameter for the blojsom servlet in /WEB-INF/web.xml.
Please read the FreeMarker documentation
for the particulars on configuring FreeMarker.
Configuring a flavor template to use the FreeMarker dispatcher
You can configure individual flavors to use the FreeMarker 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.
To configure the html flavor to use the FreeMarker dispatcher, change the line above to the following:
html=html.ftl, text/html;charset=UTF-8
You will then need to create the appropriate /WEB-INF/(blog-id)/templates/html.ftl file using the FreeMarker template syntax.
Writing templates using FreeMarker
Please read the FreeMarker reference documentation
for the details on the FreeMarker template syntax.