Пример #1
0
  public static void main(String[] args) throws Exception {
    List<Book> books = new ArrayList<Book>();
    books.add(new Book("The Hitchhiker's Guide to the Galaxy", 5.70, true, "0"));
    books.add(new Book("Life, the Universe and Everything", 5.60, false, "N"));
    books.add(new Book("The > Restaurant at the < End of the Universe & all", 5.40, true, "Yes"));

    Map<String, Object> model = new HashMap<String, Object>();
    model.put("books", books);
    model.put("pageName", "My Bookshelf");

    JadeConfiguration jadeConfiguration = new JadeConfiguration();
    jadeConfiguration.setPrettyPrint(true);
    jadeConfiguration.setMode(Jade4J.Mode.XML);

    JadeTemplate template = jadeConfiguration.getTemplate("src/main/java/jade2j/index.jade");

    StopWatch stopWatch = new StopWatch();

    stopWatch.start();
    String result = jadeConfiguration.renderTemplate(template, model);
    stopWatch.stop();

    System.out.println(result);
    System.out.println(stopWatch.toString());
  }