kindeditor使用

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page trimDirectiveWhitespaces="true"%> <!-- jsp输出的html时去除多余的空行(jsp上使用EL和tag会产生大量的空格和空行)。 -->
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="keywords" content="jquery,ui,easy,easyui,web">
    <meta name="description" content="easyui help you build your web page easily!">
    <title>jQuery EasyUI Demo</title>
    <link rel="stylesheet" type="text/css" href="<%=basePath%>/css/easyui/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="<%=basePath%>/css/jeasyui/icon.css">
    <script type="text/javascript" src="<%=basePath%>/js/jquery-1.4.4.min.js"></script>
    <script type="text/javascript" src="<%=basePath%>/js/jquery.easyui.min.js"></script>
    
    
    <link rel="stylesheet" href="<%=path%>/kindeditor/themes/default/default.css" />
    <link rel="stylesheet" href="<%=path%>/kindeditor/plugins/code/prettify.css" />
    <script charset="utf-8" src="<%=path%>/kindeditor/kindeditor.js"></script>
    <script charset="utf-8" src="<%=path%>/kindeditor/lang/zh_CN.js"></script>
    <script charset="utf-8" src="<%=path%>/kindeditor/plugins/code/prettify.js"></script> 

    
    <script type="text/javascript">
         KindEditor.ready(function(K) {
         window.editor = K.create('#editor_id');
         });
         
         var editor1;
         KindEditor.ready(function(K) {
         editor1 = K.create('textarea[name="content"]', {
         cssPath : '<%=path%>/kindeditor/plugins/code/prettify.css',
         uploadJson : '<%=path%>/kindeditor/jsp/upload_json.jsp',//标识处理图片的文件
         fileManagerJson : '<%=path%>/kindeditor/jsp/file_manager_json.jsp',
         allowFileManager : true,//允许上传文件和图片
         afterCreate : function() {
         this.sync();
         },
         afterBlur:function(){
         this.sync();
         }
         });
         prettyPrint();
         });
    </script>
</head>

<body>
    <form method="post" action="richText/saveKEditor">
        <label>标题:</label>
        <div class="content">
            <textarea name="content" id="content" 
                style="width:500px;height:300px;">在这里输入内容...</textarea>

        </div>
        <div class="btn">
            <input type="submit" value="确定" name="submit" /> <input type="reset"
                value="重置" name="reset" />
        </div>
    </form>
</body>
</html>

 

@RequestMapping("richText")
public class RichTixetController {
    
    @RequestMapping("/saveKEditor")
    public String save(String content,ModelMap map){
        
        String msg="上传成功!";
        //保存标签 
        String url="";
        map.addAttribute("msg", msg);
        url=content;
        map.addAttribute("content", content);
        
        System.out.println("richText saving..."+content.toString().trim());
        
        return "ok";
    }
}
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值