Skip to content

MochaTemplate is a template library inspired by Adobe Sightly. It leverages the power of server-side Javascript to clearly separate presentation and logic concerns.

License

Notifications You must be signed in to change notification settings

patriziobruno/mochatemplate

Repository files navigation

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>

About

MochaTemplate is a template library inspired by Adobe Sightly. It leverages the power of server-side Javascript to clearly separate presentation and logic concerns.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published