Multiple Template Engines

Guara uses a template engine to bind Java code and markup before sending the response to the browser. Actually it's not markup, it's any type of text: you can generate HTML, XML or even javascript code.

Right now velocity and freemarker are supported.

The template system completely hides the underlying template engine implementation configured on pulga.xml. For this reason you don't have to use complete template names on URLs (MyTemplate.vm). It's better if you remove the file extension (MyTemplate).

Guara allows you to use more that one template engine running at the same time. This enables a slow and seamless migration between template engines (Velocity -> Freemarker, for example).

The default template engine, will try to load the template according to your configuration on pulga.xml. First match wins.

If you are sure that you want to use a particular template engine implemention you can use the file extension to tell Guara which engine to activate. Here is an example:

  • mydir.MyTemplate: first definition wins.
  • mydir.MyTemplate.vm: uses velocity.
  • mydir.MyTemplate.ftl: uses freemarker.
No matter how your templates are loaded and parsed, you can mix layouts, screens and navigations without problems.