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

  • 相关阅读:
    [BJDCTF 2nd]fake google
    flask之ssti模板注入初窥
    ctfshow-web14
    ctfshow-web 13
    ctfshow-web12
    ctfshow-web 11
    ctfshow-web10
    ctfshow-web9
    python学习笔记(四)- 常用的字符串的方法
    python学习笔记(三)- 字典、集合
  • 原文地址:https://www.cnblogs.com/yousen/p/4736444.html
Copyright © 2011-2022 走看看