參考解決方案:
1、http://blog.csdn.net/kalision/article/details/41514467
2、http://blog.163.com/java_zf/blog/static/19926038420133801615408/
KindEditor介紹:
kindEditor是一款國產富文本編輯器,類似fckeditor和目前比較流行的百度Ueditor。其產品官方網站爲http://kindeditor.net/
KindEditor下載:
官網下載地址:(可能無法下載到歷史版本)
http://kindeditor.net/down.php
Google下載地址:
https://code.google.com/p/kindeditor/downloads/list
聯繫作者索取(不保證有最新版的):
KindEditor使用:
注意:本文使用的實例是用的 kindeditor-4.1.10 版本,
1:解壓下載的壓縮包到kindeditor目錄下;
2:將kindeditor文件夾複製到項目中,如"/webroot/"下;可以把php,asp,asp.net三個目錄刪掉。導入後的目錄結構如下所示:
3:將kindeditor/jsp/lib/下的所有jar包引入到工程中。(此版本爲3個jar包,最好是使用拷貝到WEB-INF/lib下引用);
4:在需要用到文本編輯器的JSP頁面的head部分引用js文件:
-
<script charset="utf-8" src="${pageContext.request.contextPath }/kindeditor/kindeditor.js"></script><script charset="utf-8" src="${pageContext.request.contextPath }/kindeditor/lang/zh_CN.js"></script>
- <script>
- KindEditor.ready(function(K) {
- K.create('#editor_id', {
- uploadJson : '${context}/kindeditor/jsp/upload_json.jsp',
- fileManagerJson : '${context}/kindeditor/jsp/file_manager_json.jsp',
- allowFileManager : true
- });
- });
- </script>
5:在body中添加
<textarea id="editor_id" name="content" style="width:96%;height:350px;visibility:hidden;">${WenZhang.content}</textarea>
注:textarea的id屬性值必須和head標籤內定義的K.create()中的保持一致。name屬性即爲後臺接受參數名稱的值。
${WenZhang.content}是要編輯的內容。