Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

erickzanardo/dj

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

DJ (doT for Java)

DJ is a simple API for using the doT javascript template (http://olado.github.io/doT/index.html) lib on Java.

It's is very simple to use, as the following code shows

Configure your pom to use the DJ dependency

  <repository>
	<id>erickzanardo-releases</id>
	<url>http://erickzanardo.github.com/maven/releases/</url>
  </repository>

  <dependency>
	<groupId>br.com.ez</groupId>
	<artifactId>dj</artifactId>
	<version>1.1</version>
  </dependency>
JsonObject object = new JsonObject();
  	object.addProperty("foo", "with doT");

		String result = new DJ()
				.template("<h1>Here is a sample template {{=it.foo}}</h1>")
				.context(object).result();
        
    // <h1>Here is a sample template with doT</h1>

More info about doT.js syntax on http://olado.github.io/doT/index.html.