一,首先你需要引入CKeditor包,附上下载地址http://ckeditor.com/download,将该压缩文件解压到你的webapp文件下就可以了。
二,在你的jsp页面中引用,同时对你的ckeditor进行配置工具。
<head>
<title>****</title>
<%@ include file="../common/common.jsp"%>
<script src="<%=basePath %>ckeditor/ckeditor.js"></script>
<script type="text/javascript">
/* CK Editer */
CKEDITOR.editorConfig = function( config ) {
config.toolbar =
[ { name: 'document', items: ['Source', '-', 'Preview'] },
{ name: 'insert', items: ['Image', 'Flash', 'Table', 'HorizontalRule', 'SpecialChar', 'PageBreak',] },
{ name: 'clipboard', items: ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo'] },
{ name: 'styles', items: ['Styles', 'Format', 'Font', 'FontSize'] },
{ name: 'links', items: ['Link', 'Unlink', 'Anchor'] },
{ name: 'colors', items: ['TextColor', 'BGColor'] },
"/",
{ name: 'basicstyles', items: ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat'] },
{ name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl'] }
];
config.filebrowserImageUploadUrl = '../upload/CKImgUpload';
};
</script>
</head>
三,作为jsp的数据展现,体现一个循环的展示
<c:forEach items="${List }" var="cker" varStatus="i">
<div id="ckEditers" title="${cker.name}" style="margin-bottom:30px; width: 98%;" >
<textarea class="ckeditor onload" id="content_${cker.id}" name="content_${cker.id}">${cker.content}</textarea>
</div>
</c:forEach>
四,作为jsp的数据录入
<form id="ff" method="post">
<table cellpadding="5">
<tr>
<td valign="top" align="right">内容:</td>
<td><textarea class="ckeditor" name="content"></textarea></td>
</tr>
</table>
</form