Skip to content

WTemplate

Mark Reeves edited this page Jan 3, 2018 · 4 revisions

WTemplate is a component used to add non-WComponents HTML, CSS and/or JavaScript to a Java application. Its primary uses include:

  • creating responsive layouts;
  • creating light weight page architecture into which WComponents UI controls are placed; or
  • adding client-side functionality which is not in WComponents (such as syntax highlighting) or which would require overly complex component manipulation (such as the otherwise simple task of stacking icons).

WTemplate was introduced to help overcome some of the issues inherent in the API of WComponents' layout components. These components date back to 2005 and were specifically designed to assist non-UI developers build intranet applications in pure Java. The legacy of this is a well-used API which is not ideal for building responsive, light-weight applications for the new web.

Template engines

WTemplate ships with three template engines:

  • Velocity;
  • Handlebars - a Java port which can also cope with most Mustache templates; and
  • A plain text engine which simply passes through the unescaped content of the template.

In addition to these three, WTemplate can handle any other template by creating an appropriate interface.

Clone this wiki locally