@@ -0,0 +1,1517 @@
+package com.njust.test.freemarker;%0A%0Aimport java.io.File;%0Aimport java.io.IOException;%0Aimport java.io.StringWriter;%0Aimport java.util.ArrayList;%0Aimport java.util.HashMap;%0Aimport java.util.List;%0Aimport java.util.Map;%0A%0Aimport org.junit.Test;%0A%0Aimport freemarker.template.Configuration;%0Aimport freemarker.template.Template;%0Aimport freemarker.template.TemplateException;%0A%0Apublic class FreeMarkerDemo%0A%7B%0A    @Test%0A    public void test01()%0A        throws IOException, TemplateException%0A    %7B%0A        File dir = new File(%22D:%5C%5C2222%5C%5Cfreemarker%22);%0A%0A        Configuration configuration = new Configuration();%0A        configuration.setDirectoryForTemplateLoading(dir);%0A%0A        Template template = configuration.getTemplate(%22111.ftl%22);%0A        StringWriter stringWriter = new StringWriter();%0A        Map%3CString, Object%3E dataMap = getDataMap();%0A        template.process(dataMap, stringWriter);%0A%0A        System.out.println(stringWriter.toString());%0A    %7D%0A%0A    private Map%3CString, Object%3E getDataMap()%0A    %7B%0A        Map%3CString, Object%3E dataMap = new HashMap%3C%3E();%0A        dataMap.put(%22name%22, %22dave%22);%0A%0A        List%3CString%3E weeks = new ArrayList%3C%3E();%0A        weeks.add(%22monday%22);%0A        weeks.add(%22tuesday%22);%0A        weeks.add(%22wednesday%22);%0A        dataMap.put(%22weeks%22, weeks);%0A%0A        Map%3CString, String%3E scoreMap = new HashMap%3C%3E();%0A        scoreMap.put(%22key1%22, %22value111%22);%0A        scoreMap.put(%22key2%22, %22value222%22);%0A        scoreMap.put(%22key3%22, %22value333%22);%0A        dataMap.put(%22scoreMap%22, scoreMap);%0A%0A        return dataMap;%0A    %7D%0A%7D%0A

Create FreeMarkerDemo.java