Package biz.source_code.miniTemplator

Examples of biz.source_code.miniTemplator.MiniTemplator


private static final String templateFileName = "src/examples/example2-template.html";
private static final String outputFileName   = "target/examples-output/example2-output.html";

public static void main (String args[]) throws Exception {
   MiniTemplator t = new MiniTemplator(templateFileName);
   t.setVariable("year", "2003");
   t.setVariable("month", "April");
   for (int weekOfYear=14; weekOfYear<=18; weekOfYear++) {
      for (int dayOfWeek=0; dayOfWeek<7; dayOfWeek++) {
         int dayOfMonth = (weekOfYear*7 + dayOfWeek) - 98;
         if (dayOfMonth >= 1 && dayOfMonth <= 30)
            t.setVariable("dayOfMonth", Integer.toString(dayOfMonth));
          else
            t.setVariable("dayOfMonth", "&nbsp;");
         t.addBlock("day"); }
      t.setVariable("weekOfYear", Integer.toString(weekOfYear));
      t.addBlock("week"); }
   t.generateOutput(outputFileName); }
View Full Code Here


private static final String templateFileName = "src/examples/example1-template.html";
private static final String outputFileName   = "target/examples-output/example1-output.html";

public static void main (String args[]) throws Exception {
   MiniTemplator t = new MiniTemplator(templateFileName);
   t.setVariable("animal1", "fox");
   t.setVariable("animal2", "dog");
   t.addBlock("block1");
   t.setVariable("animal1", "horse");
   t.setVariable("animal2", "cow");
   t.addBlock("block1");
   t.generateOutput(outputFileName); }
View Full Code Here

TOP

Related Classes of biz.source_code.miniTemplator.MiniTemplator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.