Overview | Examples | Writing templates | Java interface
API docs | Download

JSTE User Guide

JSTE templates are made of output text interspersed with template code fragments of the following types. A scriptlet can contain any valid Javascript code. Scriptlets can also include: The document.include call causes the template engine to read the contents of the specified parameter file and expand its contents at that point. Nested includes are allowed, i.e., included files may in turn include other files. Look here for an example.

The predefined templateContext Java object is wrapped in Javascript for easy access. Ideally, you would pass a Java Map instance for the templateContext. Doing so enables your Javascript code to access the Map as if it were a regular Javascript array. If this Map contains other Map or List instances or Java arrays within it, they are in turn wrapped automatically into the Javascript environment so that they can be accessed as if they were Javascript arrays. You can also pass any Java object as an element of the Map or its elements, and then proceed to invoke methods on the Java object.