Basics

A configuration is a place to store your common (application level) settings and define certain variables that you want to be available in all templates. Also it deals with the creation and caching of Template instances. Configurations are freemarker.template.Configuration instances.

A default Configuration instance always exists; you can get/set this singleton with the getDefaultConfiguration and setDefaultConfiguration static methods of Configuration. Though most applications will only use the default configuration object, some applications may define more than one such object. In that case you create the configurations with the Configuration constructor.

Configurations are used by the Template methods, especially by process method. Each Template instance has exactly one Configuration instance associated with it, which is assigned to the Template instance by the Template constructor; you can specify a Configuration instance as parameter, or it will use the default instance. When you obtain a template with Configuration.getTemplate, the associated Configuration instance will be the one whose getTemplate method has been called.


Page generated: 2004-06-15 22:17:59 GMT FreeMarker Manual -- For FreeMarker 2.3