What is Apache FreeMarker?
Apache 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...
Disclaimer: Apache FreeMarker is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
A few highlights of FreeMarker:
Powerful template language: Conditional blocks, iterations, assignments, string and arithmetic operations and formatting, macros and functions, including other templates, escaping by default (optional), 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 adapters, which decides how the template sees them.
FreeMarker is Free software, licensed under the Apache License, Version 2.0. See the license here....
As of 2.3.24-pre01 (2015-09-02) the copyright owner in the license has changed to the Apache Software Foundation, as the project has started Apache Incubation (see disclaimer earlier).