We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

Green Luo • 12 years ago

May I introduce my work Rythm: a high performance template engine using Razor like syntax. It's very clean and easy to use. It's 2 to 3 times faster than velocity. Have a look at http://rythmengine.com/

Sproket • 13 years ago

If you want true logic-less then look at:

http://jolene.sourceforge.net

I don't really bother maintaining it since it works for 99% of my cases. Jolene just reads HTML and stores the DOM as simple JavaScript styled object. It's a true separation of concerns.

Erik Mitchell • 11 years ago

Very interested in the handlebar portion. We implemented a very similar system at my last job, except we were using Freemarker. It was incredibly effective.

spullara • 11 years ago

You can download it directly from the maven repo and try it out:

http://repo1.maven.org/mave...

Sam

Tom McClure • 12 years ago

My java template engine, Chunk, is similarly logic-averse. It can do loops and simple if-else blocks but really tries to be just a mature tag-based template engine. Templates can come from filesystem, or a jar, or a cms/db. It has a great system for including other templates (and a framework for referencing one template from another), either straight-up:

{^include name_of_template}

or with prepared parameters

{^exec TEMPLATE}...{/exec}

Lots of built-in tag-filtering a la {~tag|trim} and you can write your own filters.

More info here:
http://code.google.com/p/ch...

Full docs here:
http://www.x5software.com/c...

jawherm • 13 years ago

Hi there,

I'm a bit late to the party I know.

I too am very interested in templating in general, and wasn't very happy with the existing solutions out there. I found Mustache to be a bit better than the rest. I've layed out my ()detailed opinions in a blog post over here: http://jawher.wordpress.com...

I've also went the extra mile and created a templating library that isn't just JSP with nicer tag names which I called Moulder and made it available under the MIT license in Github: https://github.com/jawher/m...

Here's another post that shows Moulder in action: http://jawher.wordpress.com...

Sorry for the multitude of links: I'm not just trying to spam your blog, but I'd be very interested in what you think about Moulder's approach.

Cheers !

Peter • 13 years ago

The problem with templating is that a new developer is required to learn it and it is another lib which could have bugs. Another big problem is the 'partial' thing which was really really annoying for me the last time I did RoR. So, I think "Composable components, not monolithic pages" is very hard to achieve with them ...

There are 3 template-less solutions in the Java world I am aware of:
Apache wicket where you code with Java and html,

vaadin (via gwt) where you code in pure Java,

and an agpl project itsnat (through its license I don't know much of it)

adamgent • 12 years ago

Shameless plug to my own library: http://code.google.com/p/jatl/ Which is template-less in perhaps a different way then you mean :)

Ggg • 13 years ago

come on guys!
we need logic everywhere... how could we chose less-logic stuff.... are we moron?

Koalillo • 13 years ago

Please, please, please, make it so:

* templates do not need to be stored on the filesystem
* template inclusion is as nice as JSP's tag fragments.

spullara • 13 years ago

1. How would you like to reference them? Classloader? URL?
2. The problem with this is that logic gets into your templates. Right now all the metadata that would normally be included with your tag in this framework is in the code that supports the template, not hardcoded into the template itself.

Koalillo • 13 years ago

1. I'd say provide a template lookup interface, handle them just like you do know (i.e. public interface TemplateLookupEngine { public InputStream getTemplate(String name); } or something like that).

2. OK, after re-reading partials I kinda get the idea...

The thing about most template engines I find is that they are either completely tied to the filesystem or that their mechanism for not being tied to the fs is an afterthought. I want my CMS to store templates in the same backend where I store content, with the same properties (i.e. JCR with versioning and branching, etc.).

The other thing is that template inclusion is one of the most important features in a template engine...

spullara • 13 years ago

Just realized you can already do this in mustache.java. You can pass in your own superclass for generated Mustache classes and override the partial() resolution method.

Koalillo • 13 years ago

Cool! That's a very important feature for me!

spullara • 13 years ago

1. That seems very reasonable. I was actually planning on doing something like this anyway, thanks for the reminder.
2. Yeah, jsp tag-like behavior should work but the implementation is separated out from the template.

BTW, it is an open source project and I welcome changes like #1.

Blah • 13 years ago

StringTemplate

spullara • 13 years ago

I took a look at it. The engine itself doesn't have the functionality I needed and I would have had to rewrite that part anyway but it is a reasonable language.

Eric S • 10 years ago

What functionality is that, exactly? (I ask this as someone who's arrived here via Google, researching "pure" templating languages, and who has been looking at ST, and came across a link about Mustache/java. This is one of the only hits I've found saying something in comparison of the two.)