The Joy of Mustache: Server Side Templates for the JVM
NOTE: If you are reading this in December 2023 or later, there was a 1.16 release of JMustache that added "inheritance" support. This is an optional Mustache spec feature but was previously unimplemented in JMustache. It allows you to do the "layout with included body" type templating that is very common in web apps, and needed in the sample for this article. The sample has been updated in Github to use inheritance instead of the workaround with lambdas presented below.
I don’t do much server-side templating, but when I do… well frankly, I tend to forget things. Every template language has its strengths and weaknesses, and they all have syntax to remember, and more frequently to forget. Recently I completed some work on the old Spring Petclinic, converting it to use Thymeleaf in the view layer, and re-organizing the code to be a bit more "modern". I enjoyed working with Thymeleaf 3, and found…