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

  • 相关阅读:
    redis同步指定key数据到其他redis中
    Golang 生成随机数
    怎么理解“平均负载”? 进行分析等
    Golang打印空心金字塔for循环实现
    python十几行代码实现三级菜单
    mysql增量恢复
    python内建函数
    python练习题总结
    迭代器和生成器
    python基础数据类型
  • 原文地址:https://www.cnblogs.com/yousen/p/4736444.html
Copyright © 2011-2022 走看看