// step5: 生成静态化html
FileOutputStream fos = null;
PrintStream printStream = null;
StringBuilder sb = new StringBuilder();
try {
File dest = new File(Constants.HTML_ROOT_PATH
+ newBannerDTO.getBannerNUM() + ".html");
dest.setReadable(true, false);
dest.createNewFile();
fos = new FileOutputStream(dest);
printStream = new PrintStream(fos);
sb.append("<html>");
sb.append("<head>");
sb.append("<title>Banner</title>");
sb.append("<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />");
sb.append("<body style='background:#1C2229;'>");//设置网页的的背景颜色
sb.append(banner.getContent());//ckeditor中的图片及文本内容
sb.append("</body></html>");
printStream.println(sb.toString());
newBannerDTO.setContentUrl(Constants.HTML_WEB_PATH
+ newBannerDTO.getBannerNUM() + ".html");
} catch (Exception e) {
} finally {
try {
if (fos != null) {
fos.close();
}
} catch (IOException e) {
System.out.println("文件生成...");
}
}