I'm in love with razor templates in .NET MVC 3. Is there anything close for java?
I'd be looking for something where I could avoid using JSTL tags and instead do something like this:
<c:if test=${bla}>
<span>my html</span>
</c:if>
and instead do
@if(bla)
{
<span>my html</span>
}
I'm assuming there must be similar
I'd like to introduce my work: Rythm template engine, a lightweight and super fast template engine in Java using the Razor like syntax. Rythm has rich features and supports page layout/inheritance, customized tags (either in template or java class), dynamic reload at dev mode and much more. The benchmark shows Rythm is 2 to 3 times faster than Velocity on a normal page!
The API is simple:
render with inline string:
String output = Rythm.render("@args String who;hello @who!", "world");
render with template file:
String output = Rythm.render("hello.txt", "world");
A brief introduction to Rythm: http://software-lgl.blogspot.com.au/2012/03/rythm-easy-to-use-high-performance-java.html
Updates 20120701
The latest version introduced a feature called "String Interpolation Mode", which enable you to do very lightweight string interpolation like follows:
String result = Rythm.render("hello @who!", "world");
A full feature demonstration is hosted on GAE: http://play-rythm-demo.appspot.com/
Updates 20130406
A rythm fiddle web site is online now, and you can use it to learn Rythm syntax. Check it out at http://fiddle.rythmengine.org
Updates 20130513
com.greenlaw110.rythm
to
org.rythmengine
, the maven group id changed accordingly