public class Iterate {
public static void main(String[] args) throws IOException {
// Load resources (e.g. templates) from classpath, along side this class.
JSilver jSilver = new JSilver(new ClassResourceLoader(Iterate.class));
// Set up some data.
Data data = jSilver.createData();
data.setValue("query", "Fruit");
data.setValue("results.0.title", "Banana");
data.setValue("results.0.url", "http://banana.com/");
data.setValue("results.1.title", "Apple");
data.setValue("results.1.url", "http://apple.com/");
data.setValue("results.2.title", "Lemon");
data.setValue("results.2.url", "http://lemon.com/");
// Render template to System.out.
jSilver.render("iterate.cs", data, System.out);
}