Rythm is a Strong typed Java template engine using Razor like syntax with high performance (2 to 3 times faster than Velocity and FM). It provides a very lightweight way to do String interpolation:
String result = Rythm.render("hello @who!", "world");
This simplicity makes Rythm a good replacement for String.format()
in many cases. Please be noted that Rythm.render
is 2x faster than String.format
For comprehensive template you can use the same interface to pass in the file name:
Map<String, Object> args = new HashMap<String, Object>();
args.put("who", "world");
...
String result = Rythm.render("myTemplate.html", args);
Rythm has very rich feature set including java flow control (if-else, for loop, collection iteration), template inheritance, external and internal tags creation and invocation, caching, Java method extension, space compact, html escape etc. Most of the features are demonstrated at http://play-rythm-demo.appspot.com/. (And Yes, the demo is written with Play!Framework plus Rythm template engine and it is running on GAE!)
There is Play!Framework plugin created on Rythm engine, you can find documentation on how to use Rythm from there: http://www.playframework.org/modules/rythm
You can download Rythm from https://github.com/greenlaw110/rythm/downloads