A template library inspired by Adobe Sightly (https://docs.adobe.com/ddc/en/gems/introduction-to-sightly.html).
It makes use of:
- jsoup (https://jsoup.org/) for HTML parsing
- Reflections (https://github.com/ronmamo/reflections) for runtime loading of template-nodes interpreters
- JDK native script engine (Nashorn for JDK8, Rhino for JDK7)
To use the library in your application you can either instantiate MochaTemplateEngine from your servlet or add net.desertconsulting.mochatemplate.servlet.MainServlet to your web.xml.
To run unit tests:
$ mvn test
To run a jetty instance serving the included example:
$ mvn jetty:run
<html>
<head>
<script type="server/javascript">
var Person = importClass(Packages.examples.Person);
var query = request.getParameter('search');
</script>
</head>
<body>
<div data-for-person="${Person.lookupByName(query)}">
<p>${person.FullName}</p>
</div>
</body>
</html>