FreeMarker logo
 
About
-  Overview
-  Features
Download
-  FreeMarker
-  中文版手册(for 2.3.19 - outdated!)
-  Editor/IDE plugins
-  File generator tool (FMPP)
-  FTL Libraries
Documentation
-  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
Miscellaneous
-  Powered by FreeMarker
-  SourceForge project page
-  Source code on GitHub
-  Who we are
 
Features

A few feature highlights of FreeMarker.

General purpose

  • Can be used to generate any kind of text: HTML, XML, RTF, Java source code, etc.
  • Easy to embed into your product: Lightweight, no required dependencies. Doesn't assume servlet environment.
  • Pluggable template loader: you can load templates from any sources; local files, database, etc.
  • You can do whatever you want with the generated text: store it in a local file, send it as e-mail, send it back to a Web browser from a Web application, etc.

Powerful template language

  • All the usual directives: if/elseif/else, looping through lists, include other templates.
  • Creating and changing variables in templates.
  • Can use complex expressions to specify values almost everywhere.
    • String operations: concatenation, sub-string, uppercase, capitalize, escaping, etc.
    • Decimal precision arithmetic calculations
    • Boolean arithmetic
    • Reading array (list) and associative array elements
    • Array and associative array literals
    • You can add your own functions (methods) for special calculations.
  • Custom directives (macros) with named and positional parameters and with nested content (body). For example:
    <@myMacro color="red" width=2>...</@myMacro>
    These can be defined right in the templates, or even in Java.
  • Custom directives can filter the output of their nested content, such as doing white-space compression, syntax highlighting, etc.
  • Name-spaces to help build and maintain reusable macro/function libraries or to divide big projects into separated modules without worrying about name clashes.

Versatile data model

FreeMarker does not work through direct reflection on Java objects; the Java objects are exposed to the template as a tree of variables through pluggable object wrappers. Thus, you can show the objects (Java beans, XML documents, SQL query result sets, etc.) in an abstract, tailored way for the template authors, without bothering them with technical details. This also means that objects coming for non-Java JVM languages (such as Jython) can be accessed as conveniently as "native" objects (if the proper object wrapper is implemented).

Web-ready

  • Designed for MVC pattern: separate visual design from application logic.
  • Built-in constructs in the template language to handle typical Web-related tasks like HTML-escaping.
  • Can be integrated with "Model 2" Web application frameworks out-of-the-box as JSP replacement.
  • Supports JSP taglibs via FreemarkerSerlvet (except that JSP 2 "tag files" aren't supported, i.e., when custom tags are implemented in JSP language rather than as Java classes).

Internationalization/localization-aware

  • Charset-aware (uses UNICODE internally).
  • Locale sensitive number and date/time formatting.
  • Non-US characters can be used in identifiers (as variable names).
  • Multiple variations of the same template for different languages.

XML processing capabilities

  • Terse way of walking XML nodes, like book.chapter[0].title.
  • Declarative/recursive XML processing (with the <#recurse> and <#visit> directives).
 

 

 
Found broken link or other problem with this site?
Report to: ddekanyREMOVEME@freemail.hu
(remove the "REMOVEME" from the address)
 
Page last generated: 2014-10-12 19:30:07 GMT
All content on this page is copyrighted by the FreeMarker project.
 
  SourceForge Logo    Powered by FreeMarker