What is FreeMarker?
FreeMarker is a template engine: a Java library to generate text output (HTML web pages, e-mails, configuration files, source code, etc.) based on templates and changing data. Templates are written in the FreeMarker Template Language (FTL), which is a simple, specialized language (not a full-blown programming language like PHP). You meant to prepare the data to display in a real programming language, like issue database queries and do business calculations, and then the template displays that already prepared data. In the template you are focusing on how to present the data, and outside the template you are focusing on what data to present.
This approach is often referred to as the MVC (Model View Controller) pattern, and is particularly popular for dynamic Web pages. It helps in separating the Web page designers (HTML authors) from the developers (Java programmers usually). Designers won't face complicated logic in templates, and can change the appearance of a page without programmers having to change or recompile code.
While FreeMarker was originally created for generating HTML pages in MVC web application frameworks, it isn't bound to servlets or HTML or anything Web-related. It's used in non-web application environments as well.
See the Manual for more details...
A few highlights of FreeMarker:
Powerful template language: Conditional blocks, iterations, assignments, string and arithmetic operations and formatting, macros and functions, including other templates, and many more
Multipurpose and lightweight: Zero dependencies, any output format, can load templates from any place (pluggable), many configuration options
Internationalization/localization-aware: Locale sensitive number and date/time formatting, localized template variations.
XML processing capabilities: Drop XML DOM-s into the data-model and traverse them, or even process them declaratively
Versatile data-model: Java objects are exposed to the template as a tree of variables through pluggable object wrappers, which decides how the template sees them.
FreeMarker is Free software, licensed under the Apache License, Version 2.0. See the license here...