Turbine

Essentials

Get Involved

Documentation

Howto Guides

Development

FreeMarker Service

Turbine has support for using FreeMarker as a templating tool. This is made available through our services architecture. While Turbine supports the use of many templating systems, we definitely have our favorite system to use and recommend and that is Velocity.


Configuration


# -------------------------------------------------------------------
# 
#  S E R V I C E S
#
# -------------------------------------------------------------------
# Classes for Turbine Services should be defined here.
# Format: services.[name].classname=[implementing class]
#
# To specify properties of a service use the following syntax:
# service.[name].[property]=[value]

services.FreeMarkerService.classname=org.apache.turbine.services.freemarker.TurbineFreeMarkerService
.
.
.


Usage

FreeMarkerService fm = (FreeMarkerService)TurbineServices.getInstance()
    .getService(FreeMarkerService.SERVICE_NAME);
SimpleHash context = fm.getContext(data);
context.put("message", "Hello from Turbine!");
String results = fm.handleRequest(context,"helloWorld.wm");
data.getPage().getBody().addElement(results);



Copyright © 1999-2001, Apache Software Foundation