Skip to content

Latest commit

 

History

History
42 lines (36 loc) · 1.62 KB

README.md

File metadata and controls

42 lines (36 loc) · 1.62 KB

mochatemplate

license Build Status Coverage Status Coverity Scan Build Status

A template library inspired by Adobe Sightly (https://docs.adobe.com/ddc/en/gems/introduction-to-sightly.html).

It makes use of:

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.

Test

To run unit tests:

$ mvn test

To run a jetty instance serving the included example:

$ mvn jetty:run

Example template

<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>