在网上下载KindEditor源文件,
我用的是kindEditor4.1.2版本,加压缩后目录如下图:
步骤1、将asp,asp.net,examples,php文件删除,同时将jsp中的lib文件夹下的三个jar包拷贝到WEB-INF的lib下。
步骤2、新建一个editor文件夹,将剩余的文件放到该文件下面,同时将该文件放到项目文件下面。如项目名为phone则放在phone文件下。
步骤3、在需要富文本的jsp中加入一下代码
<script charset="utf-8" src="http://www.cnblogs.com/http://www.cnblogs.com/editor/kindeditor.js"></script>
<script charset="utf-8" src="http://www.cnblogs.com/http://www.cnblogs.com/editor/lang/zh_CN.js"></script> <script> var editor; KindEditor.ready(function(K) { editor = K.create('#editor_id'); }); var options = { cssPath : '/css/index.css', filterMode : true }; var editor = K.create('textarea[name="content"]', options); </script>步骤4、将页面中需要富文本的textarea设置成如下形式
<textarea id="editor_id" name="content" style="width:700px;height:300px;"></textarea>
步骤5、后台就可以按着平常的获取参数的方法获取textarea的内容,该字段对应的mysql中的字段最好设置成text文本字段。