Jabhts is a template system which:
<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.
public class DesignTest1 { @EHtml void printPersonFullName() { pw.print("Elliott Smith"); } @EText String username = "es"; @AHref String linkUsername() { return "/info?user=es"; } @SValue(styles = "color") String clrBox() { return "red"; } @SValue(styles = "border") String clrBox() { return "1px solid black"; } }
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.