• 使用ueditor jsp方式


    下载地址:https://github.com/fex-team/ueditor/releases/tag/v1.4.3.3

    应用服务器使用:weblogic

    源码下载后,将ueditor相关文件放置到Web目录

    (1)修改ueditor.config.js配置文件

    增加以下配置:

    window.UEDITOR_HOME_URL = "/ueditor_test/ueditor/";

    修改服务器统一请求接口路径:

    serverUrl: URL + "jsp/controller.jsp"

    (2)修改config.json配置文件

    "imageUrlPrefix": "/ueditor_test"

    (3)修改controller.jsp中的rootPath

    String rootPath = this.getServletConfig().getServletContext().getResource("/").getPath();

    (4)新建index.jsp测试界面

    <%@page contentType="text/html" pageEncoding="GBK"%>
    <!DOCTYPE html>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=GBK">
            <title>JSP Page</title>
    
            <script type="text/javascript" charset="utf-8" src="ueditor/ueditor.config.js"></script> <!--ueditor的配置文件-->
            <script type="text/javascript" charset="utf-8" src="ueditor/editor_api.js"></script> <!--ueditor核心文件-->
            <script type="text/javascript" charset="utf-8" src="ueditor/lang/zh-cn/zh-cn.js"></script> <!--ueditor语言文件-->
    
            <style type="text/css">
                div{
                    width:100%;
                }
            </style>
        </head>
        <body>
            <div>
                <script id="editor" type="text/plain" style="800px;height:300px;"></script>
            </div>
    
            <div>
                <button onclick="getContent()">获得内容</button>
            </div>
    
            <script type="text/javascript">
                var ue = UE.getEditor('editor');
    
                function getContent() {
    
                    var content = UE.getEditor('editor').getContent();
    
                    alert(content);
                }
            </script>
        </body>
    </html>

     注意:修改editor_api.js中的ueditor源码路径:baseURL = 'ueditor/_src/';

    (5)应用效果

  • 相关阅读:
    第二次作业
    复盘一个商品期货的通用模型
    C#如何获取枚举(Enum)变量的值
    [C#]Socket通信BeginReceive异步接收数据何时回调Callback
    [C#]浮点数除零无法捕获异常的解决办法
    js对字符串进行编码方法总结
    web最全资源网址
    简单粗暴地理解js原型链--js面向对象编程
    常见前端九十道面试题及答案-韩烨
    C语言文件读写,复制
  • 原文地址:https://www.cnblogs.com/yshyee/p/14004897.html
Copyright © 2020-2023  润新知