A Little Note About Templating With Freemarker

Freemarker Template Engine is a library which is used to make a template that it can be dynamically merged with dynamic data. Actually we can generate this template by hard coded directly in hot code. But the lack of this method is that if we want to change the static side of template, we have to recompile the code.

Recompile the code? It sounds easy things to do for you? Not really. In my world, recompile the code means that we have to redeploy the application to J2EE server again. Sometimes it’s so hurting for me.

With freemarker, the static side of template can be saved in separate file. We don’t need to recompile the code conform to the template changes.

The idea is simple: You need two things, the static side of template which is saved in separate file, load your dynamic content, and “merge” this two things into one package of String by freemarker engine.

You can learn freemarker more details on: http://freemarker.sourceforge.net

Cuplikan dari catatan kecil saya tentang template engine freemarker. Jika tertarik dengan freemarker, silakan mempelajarinya di website-nya. Dokumentasinya termasuk mudah untuk dipelajari dengan cepat. Saya menuliskannya dalam bahasa Inggris, itu kebetulan saja. Nggak usah dikritik soal grammar-nya, bahasa Inggris saya memang jelek kok 😛

Catatan tersebut bisa didownload di box saya.

Categorized as Java

By Galih Satriaji

Bookaholic, Workaholic. Chubby. That's me!


Leave a comment

Your email address will not be published.