FreeMarker logo
-  Overview
-  Features
-  FreeMarker
-  中文版手册(for 2.3.19 - outdated!)
-  Editor/IDE plugins
-  File generator tool (FMPP)
-  FTL Libraries
-  Manual
-  Java API
-  Manual » Template Author's Guide
-  Manual » Programmer's Guide
-  Manual » Expressions cheat sheet
-  Manual » List of ?built_ins
-  Manual » List of #directives
-  Manual » List of .special_variables
-  Manual » FAQ
-  Manual » Glossary
-  Manual » Change log (versions)
-  Manual » Alphabetical Index
Community, help
-  Report bugs here
-  Ask Help on Stack Overflow, tag "freemarker"
-  Mailing lists for deeper discussions
-  Twitter to keep track of events/releases
-  Online template tester
-  Powered by FreeMarker
-  SourceForge project page
-  Source code on GitHub
-  Who we are


21 June 2015: FreeMarker 2.3.23 Release Candidate 1 is available

Test it, and give feedback! Final release is planned for July the 5th.

A quick overview of the most important changes (see full documentation in the downloadable distribution):

  • Listing-related (#list) specialized convenience features that target some of the most typical tasks in templates:
    • New #list directive child directives, #else and #items deal with the special cases with 0-length lists. #sep makes inserting separators between items much easier than it was with if + var_has_next.
    • New built-ins that act on loop variables: var?index (deprecates var_index), var?counter (1-based index), var?has_next (deprecates var_has_next), var?item_parity (returns "odd" or "even"), var?item_cycle("lightRow", "darkRow"), and some more.
  • Convenience assignment operators, like in <#assign counter++> and <#assign counter += 2>
  • True ternary operator equivalent: someBoolean?then(whenTrue, whenFalse)
  • Switch as expression: someValue?switch(case1, result1, case2, result2, ... caseN, resultN, defaultResult)
  • FTL now supports camel case for the identifiers that are part of the template language. For example, <#noEscape>${x?upperCase}</#noEscape> or <#setting numberFormat="0.0"> or <#ftl stripText=true> are valid. You can just start using camel case without configuring anything, however, within the same template, FreeMarker will require you to use the same naming convention for all identifiers that are part of the template language. (Also, a certain naming convention can be enforced for all templates from configuration.)
  • More configurable template loading for FreemarkerServlet, also loading from Servlet 3.0 META-INF/resources now works as expected
  • Various bugfixes

You can download FreeMarker 2.3.23-rc01 here... (Binary-only for Google App Engine is here...)

29 December 2014: Online FreeMarker template tester

Here's a simple but useful online FreeMarker template tester page, thanks to Nir Feldman of Kenshoo:

1 March 2015: FreeMarker 2.3.22 was released

See the change log here! A quick overview of the most important areas:

  • DefaultObjectWrapper improvements (mostly on the field of Map and List wrapping), enabled by incompatible_improvements 2.3.22.
  • Improved FreemarkerServlet (mostly on the field of TLD discovery options and error message quality)
  • More customizable template loading (lookup) mechanism, like customizing how localized variation names look, or using a custom lookup condition
  • Support for using minus sign, colon and dot in any identifiers after a preceding backslash (like in <@myMacro data\ />)
  • A new built-in for accessing the Java API of an object behind the object wrapping façade (disabled by default). For example, myMap?api.myBusinessProperty translates to myMap.getMyBusinessProperty() in Java, while myMap.myBusinessProperty would translate to myMap.get("myBusinessProperty").
  • New options to control logging
  • See many more here...

You can download FreeMarker 2.3.22 here... (Binary-only for Google App Engine is here...)

29 December 2014: Online FreeMarker template tester

Here's a simple but useful online FreeMarker template tester page, thanks to Nir Feldman of Kenshoo:

What is FreeMarker?

FreeMarker is a "template engine"; a generic tool to generate text output (anything from HTML to autogenerated source code) based on templates. It's a Java package, a class library for Java programmers. It's not an application for end-users in itself, but something that programmers can embed into their products.

FreeMarker is designed to be practical for the generation of HTML Web pages, particularly by servlet-based applications following the MVC (Model View Controller) pattern. The idea behind using the MVC pattern for dynamic Web pages is that you separate the designers (HTML authors) from the programmers. Everybody works on what they are good at. Designers can change the appearance of a page without programmers having to change or recompile code, because the application logic (Java programs) and page design (FreeMarker templates) are separated. Templates do not become polluted with complex program fragments. This separation is useful even for projects where the programmer and the HTML page author is the same person, since it helps to keep the application clear and easily maintainable.

Although FreeMarker has some programming capabilities, it is not a full-blown programming language like PHP. Instead, Java programs prepare the data to be displayed (like issue SQL queries), and FreeMarker just generates textual pages that display the prepared data using templates.

Overview of FreeMarker workflow

FreeMarker is not a Web application framework. It is suitable as a component in a Web application framework, but the FreeMarker engine itself knows nothing about HTTP or servlets. It simply generates text. As such, it is perfectly usable in non-web application environments as well. Note, however, that we provide out-of-the-box solutions for using FreeMarker as the view component of Model 2 frameworks (e.g. Struts), which also let you use JSP taglibs in the templates.

FreeMarker is Free software, licensed under the Apache License, Version 2.0. See the license here...

Read more feature highlights.



Found broken link or other problem with this site?
Report to:
(remove the "REMOVEME" from the address)
Page last generated: 2015-06-21 10:31:15 GMT
All content on this page is copyrighted by the FreeMarker project.
  SourceForge Logo    Powered by FreeMarker