FreeMarker logo
 
About
-  Overview
-  Features
Download
-  FreeMarker
-  中文版手册(PDF)
-  Editor/IDE plugins
-  File generator tool (FMPP)
-  FTL Libraries
Documentation
-  Manual
-  Java API
-  Manual » FAQ
-  Manual » Alphabetical Index
-  Manual » Expression syntax cheat sheet
-  Manual » Index of ?built_ins
-  Manual » Index of #directives
-  Manual » List of .special_variables
-  Manual » Change log (versions)
-  Manual » Glossary
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

This page attempts to give you few highlights of FreeMarker features.

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. Does not require servlet environment (does not depend on javax.servlet classes).
  • 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 usual directives: include, if/elseif/else, loop constructs.
  • 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 and associative array elements
    • Array and associative array literals
    • You can add your own functions (methods) for special calculations.
  • Macros with named and positional parameters and with nested content (body). For example:
    <@myMacro color="red" width=2>...</@myMacro>
  • Name-spaces to help build and maintain reusable macro libraries or to divide big projects into separated modules, without worrying about name clashes.
  • Output transformation blocks. Do transformations as HTML-escaping, compression, syntax-highlight etc. on the output generated by the nested template fragment. You can define your own transformations.

Versatile data model

FreeMarker does not work through direct reflection on Java objects; the Java objects are exposed to the template as 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.

Web-ready

  • 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, up to JSP 2.1 currently, except that the JSP 2 "tag files" (i.e., when custom tags are implemented in JSP language rather than as Java classes) are not supported.
  • Designed for MVC pattern: separate visual design from application logic, separate page designers from programmers.

Internationalization/localization aware

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

Powerful XML Processing Capabilities

  • <#recurse> and <#visit> directives (new in version 2.3) for recursively walking an XML tree
  • Clean, intuitive XML object model accessible from template.
 

 

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