代码调整
This commit is contained in:
@@ -20,12 +20,13 @@ public class FreemarkerUtil {
|
||||
public static String generateString(String templateFileName, String templateDirectory, Map<String, Object> datas)
|
||||
throws IOException, TemplateException {
|
||||
Configuration configuration = new Configuration(Configuration.VERSION_2_3_0);
|
||||
|
||||
// 设置默认编码
|
||||
configuration.setDefaultEncoding("UTF-8");
|
||||
|
||||
// 设置模板所在文件夹
|
||||
path = java.net.URLDecoder.decode(path, "utf-8");
|
||||
System.out.println("路径为:" + path);
|
||||
System.out.println("templateDirectory:" + templateDirectory);
|
||||
configuration.setDirectoryForTemplateLoading(new File(path + templateDirectory));
|
||||
|
||||
// 生成模板对象
|
||||
|
||||
Reference in New Issue
Block a user