Dashboard > blojsom > ... > Developers Guide > Configuring the FreeMarker dispatcher
  blojsom Log In   View a printable version of the current page.  
  Configuring the FreeMarker dispatcher
Added by David Czarnecki, last edited by David Czarnecki on Jan 14, 2005  (view change)
Labels: 
(None)

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.
    ftl=org.blojsom.dispatcher.FreeMarkerDispatcher
    
  • 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.

<init-param>
    <param-name>freemarker-properties</param-name>
    <param-value>/WEB-INF/freemarker.properties</param-value>
</init-param>

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.

Site running on a free Atlassian Confluence Open Source Project License granted to blojsom. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.4 Build:#809 Jun 12, 2007) - Bug/feature request - Contact Administrators