Chunk Home
Full Docs
Google Code Project Page
SourceForge Project Page
Chunk Templates for Java
The clean, intuitive way to generate HTML.
Or XML. Or plain text documents. Or...
Get Chunk 2.1.1
Look over the examples below and enjoy the power of clean, tag-based Chunk templates.
Getting Started
Hello Chunk
Tag pass-through
Set output for undefined tags
Nestable if - elseif - else
Loop in a list/array
Loop in an object's attributes
Include another template
Exec - execute macros
Dump all available tags
Template from Strings (no files)
Bind pojo/bean data to template
Fun with Tag Filters
Uppercase, Lowercase
Regular Expressions (RegEx)
Format numbers with sprintf
Escaping and unescaping
Add 20 pixels
Indent five spaces
Join an array, zebra stripes
Display the 3rd array element
Hashing filters and base64
Is tag value a list/object?
Write your own filter
Advanced Examples
Layered Inheritance
Localization and translations
Load templates outside classpath
Hide errors, route to STDERR
Literal blocks
Data Capsules (easy MVC)
Loop in DB query results
Write your own filter
Write your own custom .tag
Load templates from a db, or...