Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?


Failed to load latest commit information.
Latest commit message
Commit time

Chunk Templates for Java

Full documentation at

Chunk is a Java Template Engine for applications that serve HTML or XML. It's the little engine that can handle any templating job, plain text, markup, markdown, whatever, wherever.

Chunk is compact and speedy, easy to learn yet very powerful.

Chunk templates provide a rich featureset: in-tag filters, in-tag default values, includes, looping and branching, defining multiple snippets per template file, layered themes, macros, and much much more.

Free to use, copyright waived. MIT License.

Quick Start

Browse the fabulous documentation chock full of examples and recipes.

Download the latest chunk-template jar. Works with Java 1.5 and up.

Available from Maven Central:



  • Compatible with Android, GAE (Google App Engine), Spring MVC.
  • Nestable looping and branching (if/elseIf/else).
  • Macros, includes and conditional includes.
  • Speedy rendering engine that pre-parses templates.
  • Curly-brace {$tags} pop nicely in a backdrop full of <AngleBrackets> (and your xml/html can still validate).
  • Flexible null-handling; template designer may easily specify default tag values.
  • Swiss army knife of chainable filters a la {$tag|trim}, including regex (regular expressions), sprintf.
  • Localization framework.
  • Rapid MVC: Glue a "model" object (or objects) to a "view" template with a single line of controller code.
  • Define multiple composable snippets per template file.
  • Stateless tags - encourages cleaner code via separation of concerns.
  • Support for theme layers with layered inheritance.
  • Hooks for extending - add your own filters, template loader, or tag protocol.
  • Eclipse Template Editor plugin available with syntax highlighting & more.

An Eclipse plugin provides syntax highlighting, outline navigation pane for snippets in .chtml files, and auto-hyperlinks of snippet references. Requires Eclipse Helios (3.6) or better. Get the plugin.


Most features work fully with the standalone jar. A couple advanced features can be unlocked by adding these libraries to the classpath:

  • Enable jeplite-powered math expression evaluation via the |calc(...) filter - download jeplite jar or fetch via maven:

Android: Binding Beans to Template

Note: on Android (optional) - to make use of chunk.setToBean("tag",bean) binding, just make sure to include this additional dependency in your project:


Or download madrobotbeans-0.1.jar directly. Thanks to Elton Kent and the Mad Robot project.