Jabhts is a template system which:

  1. Uses 100% clean html without any special tags or attributes. You can even add mock-up data so you can preview the final design in the browser/html-editor without any need to run it through the template processor first.
  2. Uses java annotations to specify the dynamic parts of the html templates: which elements have their content generated by java, which elements are loops (e.g. table rows).
  3. Has unique support for (a) scoping loops (e.g. table rows) by supporting inner-classes and Iterator/Iterable, (b) specifying sub-attribute values such as css class names and style attributes. It doesn't just append text to the attribute value, but parses the content so you can suppress class names and css provided by the template.


<div class='_Box UserInfo' style='margin: 0; color: blue;'>
     You're logged in as
     <span id=PersonFullName>John Doe</span>
     (<a id=_Username>jdoe</a>).</div>
<div class=UserInfo 
     style='margin: 0; color: red; border: 1px solid black'>
     You're logged in as
     <span id=PersonFullName>Elliott Smith</span>
      (<a href='/info?user=es'>es</a>).</div>

The java code is all that it takes to implement the dynamic parts of the
template. There is no additional specification.
You would of course need to implement the full servlet interface.

Note: id attributes (and class names) which has a leading underscore
is automatically suppressed in the output by the template engine.

See the 30 second introduction for more info and more examples.

Minimal servlet:
public class DesignTest1 {
    void printPersonFullName() {
        pw.print("Elliott Smith"); 

    String username = "es";

    String linkUsername() {
        return "/info?user=es";

    @SValue(styles = "color")
    String clrBox() {
       return "red";

    @SValue(styles = "border")
    String clrBox() {
       return "1px solid black";

Getting the source

Latest version is available as jabhts.zip.

HTML templates are read using The Validator.nu HTML Parser


The initial version of Jabhts was created by Peter Speck as a project at Roskilde University. The project report is available in 2 parts: main report and source code appendix. Even when considering the changes made to Jabhts since the initial version, the project report is still worth reading as it documents the design decisions behind the system. It too describes the high-level design of the compiler, so it is a good introduction to the internals when you want to poke in its internals.