goja-web/src/main/java/goja/mvc/Freemarkers.java
public static void makeHtml(String tlDirectory, String tlName, Map<String, Object> paramMap,
                                String htmlPath) {
        FileOutputStream fileOutputStream = null;
        OutputStreamWriter outputStreamWriter = null;
        try {
            Configuration configuration = new Configuration(Configuration.VERSION_2_3_22);
            File file = new File(tlDirectory);// .ftl模板目录
            configuration.setDirectoryForTemplateLoading(file);
            configuration.setObjectWrapper(new DefaultObjectWrapper(Configuration.VERSION_2_3_22));
            Template template = configuration.getTemplate(tlName, StringPool.UTF_8);

            File file2 = new File(htmlPath);// 生成html目录
            fileOutputStream = new FileOutputStream(file2);
            outputStreamWriter = new OutputStreamWriter(fileOutputStream, StringPool.UTF_8);
            BufferedWriter bufferedWriter = new BufferedWriter(outputStreamWriter);
            template.process(paramMap, bufferedWriter);
            bufferedWriter.flush();
            outputStreamWriter.close();
            fileOutputStream.close();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (TemplateException e) {
            e.printStackTrace();
        } finally {
            if (null != fileOutputStream) {
                try {
                    fileOutputStream.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            if (null != outputStreamWriter) {
                try {
                    outputStreamWriter.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
public static void makeHtml(String tlDirectory, String tlName, Map<String, Object> paramMap,
                                String htmlPath) {
        FileOutputStream fileOutputStream = null;
        OutputStreamWriter outputStreamWriter = null;
        try {
            Configuration configuration = new Configuration(Configuration.VERSION_2_3_22);
            File file = new File(tlDirectory);// .ftl模板目录
            configuration.setDirectoryForTemplateLoading(file);
            configuration.setObjectWrapper(new DefaultObjectWrapper(Configuration.VERSION_2_3_22));
            Template template = configuration.getTemplate(tlName, StringPool.UTF_8);

            File file2 = new File(htmlPath);// 生成html目录
            fileOutputStream = new FileOutputStream(file2);
            outputStreamWriter = new OutputStreamWriter(fileOutputStream, StringPool.UTF_8);
            BufferedWriter bufferedWriter = new BufferedWriter(outputStreamWriter);
            template.process(paramMap, bufferedWriter);
            bufferedWriter.flush();
            outputStreamWriter.close();
            fileOutputStream.close();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (TemplateException e) {
            e.printStackTrace();
        } finally {
            if (null != fileOutputStream) {
                try {
                    fileOutputStream.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            if (null != outputStreamWriter) {
                try {
                    outputStreamWriter.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
生成HTML

@param tlDirectory tl模板目录
@param tlName      ftl模板
@param paramMap    参数map
@param htmlPath    生成HTML存放路径