I have a website that uses JSP as its view technology (and Spring MVC underneath). Unfortunately, JSP is just a pain to use for anything that doesn't involve an HTTP session. I would like to be able to occasionally send my users some email, and I want to use something JSP-like to render the email's contents. Technologies I'm aware of include:
Is there a preferred technology for templating in a Java system? Would folks generally recommend Velocity? Is there a good way to use JSP for more generic tasks?
In the pursuit of comparison between FreeMarker , Thymeleaf, Groovy and Mustache, FreeMarker has the upper hand in performance. However, Thymeleaf wins the battle overall.
I used Freemarker a lot for e-mail templating and it worked great and was easy to use.
You should go with Velocity. It's easy to learn and has a low dependency and implementation footprint, especially when using Spring.
But, if it's just one Use Case, you should stick with the String and unless you have no time for experiments ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With