CKEditor4.x && JSP
官网下载CKEditor,可选Basic, Standard, Full
解压放置其WebRoot下



JSP中引入以下文件:

<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="ckeditor/config.js"></script>
有以下几种方法可实现CKEditor
一:通过设置class样式
<textarea class="ckeditor" name="editor1"></textarea>

二:使用JS代码

$(document).ready(function(){
CKEDITOR.replace('entity_content'); //entity_content为textarea元素ID
});
三:使用jquery
使用jquery之前一定要先引入jquery文件,另外还要引入ckeditor/adapters下的一个jquery.js
(两者不一样,务必要引入)
$(document).ready(function(){
$('textarea#editor1').ckeditor();
});

另外配置config.js以满足自己的项目需求。

CKEDITOR.editorConfig = function( config ) {
// Define changes to default configuration here.
// For the complete reference:
// http://docs.ckeditor.com/#!/api/CKEDITOR.config // The toolbar groups arrangement, optimized for a single toolbar row.
config.toolbarGroups = [
{ name: 'document', groups: [ 'mode', 'document', 'doctools' ] },
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ] },
{ name: 'forms' },
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ] },
{ name: 'links' },
{ name: 'insert' },
{ name: 'styles' },
{ name: 'colors' },
{ name: 'tools' },
{ name: 'others' },
{ name: 'about' }
]; // The default plugins included in the basic setup define some buttons that
// we don't want too have in a basic editor. We remove them here.
config.removeButtons = 'Cut,Copy,Paste,Undo,Redo,Anchor,Underline,Strike,Subscript,Superscript'; // Let's have it basic on dialogs as well.
config.removeDialogTabs = 'link:advanced';
};

根据需要  具体配置查阅其他资料

PS:需要注意的是路径问题,在引入js的时候 如果ckeditor放在了WebRoot根目录下。
src应该是src="ckeditor/ckeditor.js" ,不能为src="/ckeditor/ckeditor.js"

最新文章

  1. PBOC2.0中消费交易流程
  2. OSVERSIONINFO的用法及实例
  3. POJ 3279 Fliptile (质量不错)
  4. web_api vs2015 新加标题无法打开
  5. ThinkPHP中使用ajax接收json数据的方法
  6. SQL入门学习5-函数、为此、CASE表达式
  7. IOC:AutoFac使用demo
  8. RSA加密通信小结(三)--生成加解密所需的SSL命令与流程
  9. 一起来学linux:网络命令
  10. java 浅拷贝和深拷贝 对象克隆clone
  11. centos7 安装步骤
  12. CentOS6.5如何设置NAT网络方式
  13. 问题:grid卸载后重新安装时ASM磁盘识别不到了
  14. mongodb centos7上的安装
  15. 消息/事件, 同步/异步/协程, 并发/并行 协程与状态机 ——从python asyncio引发的集中学习
  16. maven仓库地址配置
  17. LIFO栈 ADT接口 数组实现
  18. Openssl rsa命令
  19. linux安装配置redis
  20. C++ 下使用curl 获取ftp文件

热门文章

  1. [LeetCode] 033. Search in Rotated Sorted Array (Hard) (C++)
  2. 【Hibernate步步为营】--映射合集汇总
  3. 【转】Appium基于安卓的各种FindElement的控件定位方法实践
  4. Access to the temp directory is denied. Identity &#39;NT AUTHORITY\NETWORK SERVICE&#39; under which XmlSerializer is running does not have sufficient permiss
  5. DataTable与实体类的转换
  6. 6、Cocos2dx 3.0游戏开发的基本概念找个小三场比赛
  7. asp.net 操作XML
  8. springmvc继承activemq(原创)
  9. 小议 js 下字符串比较大小
  10. C# 解析bt种子