<div class="iteye-blog-content-contain" style="font-size: 14px"></div>
<pre>
// templatePath模板文件存放路径
// templateName 模板文件名称
// filename 生成的文件名称
public static void analysisTemplate(String templatePath, String templateName, String fileName, Map<?, ?> root) {
try {
Configuration config = new Configuration();
// 设置要解析的模板所在的目录,并加载模板文件
config.setDirectoryForTemplateLoading(new File(templatePath));
// 设置包装器,并将对象包装为数据模型
config.setClassicCompatible(true);
config.setObjectWrapper(new BeansWrapper());
config.setNumberFormat("0.##");
config.setTemplateExceptionHandler(TemplateExceptionHandler.IGNORE_HANDLER);
// config.setTemplateExceptionHandler(TemplateExceptionHandler.IGNORE_HANDLER);
// config.setTemplateUpdateDelay(0);
// config.setDateTimeFormat("yyyy-MM-dd HH
<pre>
// templatePath模板文件存放路径
// templateName 模板文件名称
// filename 生成的文件名称
public static void analysisTemplate(String templatePath, String templateName, String fileName, Map<?, ?> root) {
try {
Configuration config = new Configuration();
// 设置要解析的模板所在的目录,并加载模板文件
config.setDirectoryForTemplateLoading(new File(templatePath));
// 设置包装器,并将对象包装为数据模型
config.setClassicCompatible(true);
config.setObjectWrapper(new BeansWrapper());
config.setNumberFormat("0.##");
config.setTemplateExceptionHandler(TemplateExceptionHandler.IGNORE_HANDLER);
// config.setTemplateExceptionHandler(TemplateExceptionHandler.IGNORE_HANDLER);
// config.setTemplateUpdateDelay(0);
// config.setDateTimeFormat("yyyy-MM-dd HH