zoukankan      html  css  js  c++  java
  • 利用ckeditor 富文本编辑插件静态化网页

    // 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("文件生成...");
                    }
                }

  • 相关阅读:
    C++类中的函数重载
    C++中的友元
    bzoj 2820
    莫比乌斯函数
    bzoj 2440: [中山市选2011]完全平方数
    莫比乌斯反演1
    [转]C++ 指针和引用
    P2756 飞行员配对方案问题
    P2055 [ZJOI2009]假期的宿舍
    P2654 原核生物培养
  • 原文地址:https://www.cnblogs.com/yousen/p/4736444.html
Copyright © 2011-2022 走看看