读书人

java生成FTL资料

发布时间: 2012-12-21 12:03:49 作者: rapoo

java生成FTL文件

java生成FTL文件核心代码:String path = ServletActionContext.getServletContext().getRealPath("/cms");

String templateName = DateUtil.convertDate(new Date(), "").replaceAll("-", "").replaceAll(":", "").replaceAll(" ", "");File templatePath = new File(path);if(!templatePath.exists()||!templatePath.isDirectory()){templatePath.mkdir();}String tempFlie = templateName+".ftl";File templateFile = new File(templatePath,tempFlie);FileWriter fw = new FileWriter(templateFile);fw.write(sb.toString());fw.flush();fw.close();

读书人网 >编程

热点推荐