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

  • 相关阅读:
    charles安装以及手机端的设置
    ON DUPLICATE KEY UPDATE 用法与说明
    亿级流量架构之网关设计思路、常见网关对比
    灰度发布系统架构设计
    Jmeter 并发测试
    springboot --- Swagger UI初识
    TortoiseGIT 一直提示输入密码的解决方法!
    MySQL 5.6 参数详解
    LVS 轮询调度详解
    MongoDB 权限
  • 原文地址:https://www.cnblogs.com/yousen/p/4736444.html
Copyright © 2020-2023  润新知