Get the template

Templates are represented by freemarker.template.Template instances. Typically you obtain a Template instance from the Configuration instance. Whenever you need a template instance you can get it with its getTemplate method. Store the example template in the test.ftlh file of the earlier set directory, then you can do this:

Template temp = cfg.getTemplate("test.ftlh");

When you call this, it will create a Template instance corresponds to test.ftlh, by reading /where/you/store/templates/test.ftlh and parsing (compile) it. The Template instance stores the template in the parsed form, and not as text.

Configuration caches Template instances, so when you get test.ftlh again, it probably won't read and parse the template file again, just returns the same Template instance as for the first time.