博文

目前显示的是标签为“template”的博文

Review FreeMarker

//1. Create a configuration instance          Configuration cfg = new Configuration(Configuration.VERSION_2_3_23);          cfg.setDirectoryForTemplateLoading(new File(" templates ")); //templates is the parallel of src          cfg.setDefaultEncoding("UTF-8");          cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); //2. Get the template          Template t1 = cfg.getTemplate(" a.ftl ");        //3.Create a data-model          Map<String, Object> rt = new HashMap<String, Object>();          rt.put("user","Jetma");          rt.put("random", Math.random()*100);               ...