UEditor练习(JSP版)

下载[1.4.3.3 Jsp 版本]的utf-8版

将ueditor.all.js里面的href:editor.options.themePath + editor.options.theme + "/css/ueditor.css",

这个css路径改为_css.

直接放jsp源码:

<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
    <script type="text/javascript" charset="utf-8" src="ueditor/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="js/ueditor.all.js"></script>
    <script type="text/javascript" charset="utf-8" src="ueditor/lang/zh-cn/zh-cn.js"></script>
    <link href="https://ueditor.baidu.com/ueditor/themes/default/css/ueditor.css" type="text/css" rel="stylesheet">
    <script src="https://ueditor.baidu.com/ueditor/third-party/codemirror/codemirror.js" type="text/javascript" defer="defer"></script>
    <link rel="stylesheet" type="text/css" href="https://ueditor.baidu.com/ueditor/third-party/codemirror/codemirror.css">
    <script src="https://ueditor.baidu.com/ueditor/third-party/zeroclipboard/ZeroClipboard.js" type="text/javascript" defer="defer"></script>
    <script type="text/javascript" src="js/jquery.min.js"></script>
</head>
<body>

    <script type="text/plain" id="myEditor1" style="margin-bottom:100px;">
    </script>

    <a href="javascript:void(0);" id="submit">提交</a>
    
    <script type="text/javascript">
    
        var ue = UE.getEditor("myEditor1", {
            theme:"default", //皮肤
            lang:"zh-cn" //语言
        });
        
        ue.addListener("ready", function () {
            ue.execCommand("source");
        });
        
        ue.addListener("ready", function () {
            ue.execCommand("inserthtml", "<a style='color:#00ff00;'>丽塔·洛丝薇瑟</a>");
        });
        
        $("#submit").on("click", function(){
            var html = ue.getContent();
            console.log(html);
        });
        
    </script>

</body>
</html>

效果图:

UEditor练习(JSP版)

 

完成了.

上一篇:QT qss选择器------ID 选择器


下一篇:消息中间件-技术专区-RabbitMQ基本介绍