Skip to content
mrleoyoung edited this page Sep 4, 2012 · 32 revisions

Links:

Japid-Play, a template engine at raw Java speed

Note: Read the Play’s template language to understand the basic syntax of Japid, since Japid’s syntax is largely based on the Play’s syntax.

There is a detailed explanation of the Japid architecture and general usage in the download area: Japid.pdf. It is a little out of date and to be updated though.

0. License:

Apache License, Version 2.0.

1. Purpose of this work

Japid is a Java-based dynamic content rendering templates system that aims to deliver the fastest possible result.

It’s a generic template engine that can be used by any Java applications to render any Java objects. It also provides adapters specifically for the Play! Framework.

The main goal of Japid is for use in large and high traffic Play! bases web sites. To reach that goal, Japid transforms html based mark-up files to clean Java source code thus the rendering work can reach near raw Java speed.

The high-performance does not come at the cost of advanced features such as site-mesh like layout, tags, template inheritance, content caching, server-side include.

This document focuses on using the Japid module for the Play! Framework.

2. Features

- templates are strongly typed. A template must declare the arguments it takes.
- transformed to Java for best possible performance.
- a clear Java object model for templates.
- expression language is plain Java.
- templates are precompiled to Java, with commandline tool integrated with play command

3. The performance

Some rough numbers:

Hand-written Java code: 0.85X
Velocity 2X
Freemarker: 3X
Play! rendering layer in Groovy 4-12X

When integrated in Play, Japid can help Japid deliver 2-3X more total throughput under load.

4. The limitations

- No other EL than Java can be used in expressions.
- Action URL reverse lookup is weak.

5. Thanks

Thanks go to the original Play authors for a well thought-out web framework for best development time productivity and run-time performance. Some of the code in this template engine is shamefully adapted from the Play code. The Jamon template engine proves
transforming templates to Java source code is possible and has inspired me to start this project.