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

  • 相关阅读:
    Gym 101466(完整)
    HDU 3639 Hawk-and-Chicken (强连通缩点+DFS)
    hdu3394--Railway(点的双连通分量)
    hdu2732 Leapin' Lizards 最大流+拆点
    hdu2609 How many 字典树+最小表示法
    hdu2594 Simpsons’ Hidden Talents LCS--扩展KMP
    hdu2509 Be the Winner 博弈
    hdu2461 Rectangles 线段树--扫描线
    hdu2389 Rain on your Parade 二分图匹配--HK算法
    hdu2328 Corporate Identity 扩展KMP
  • 原文地址:https://www.cnblogs.com/yousen/p/4736444.html
Copyright © 2011-2022 走看看