Java Web Server Templates

Templates are a content management feature of the Java Web Server. You create a template and format definitions which the Template Servlet then applies to the content of your HTML files. This creates pages with a consistent format which are then sent to the client's browser.

You define templates in template files and definition files.

The Template File

The default.template file is an HTML file. You use it to specify whatever graphics, banners, footers, tables, etc. that you that you want to insert in your files. It also contains extensions to HTML that direct the Template Servlet to copy the contents of the HEAD section and the BODY section of your files into the template. The template applies its own HEAD attributes (such as background color, text color, etc.) that overrides the HEAD attributes of your HTML files. Note that everything inside the HEAD and BODY sections of your files is copied; anything outside of those sections is ignored.

The Definition File

The default.definitions file is a simple Java properties file that behaves like any other Java properties file. It contains a list of name/value pairs that are used by the template file. You usually store the definition file in the same directory as your HTML content files.

The definition file is not required, but it is useful for changing values without having to alter the template file. You can also customize your pages by storing variations of the definition file in subdirectories.

A definition file contained in a subdirectory inherits the attributes defined in the definition file in the directory above it. You can use the definition file in the subdirectory to override or redefine selected attributes in the definitions file in the directory above it. Thus you can create a different look for your files on a directory-by-directory basis.

To see examples of the template and definition files, see the default.template and default.definitions files that are located in this directory and its subdirectories.


The Java Web Server Team