ckeditor API CHM Help documentation http://download.csdn.net/detail/guoquanyou/3622884
JSP pages submit form data using Rich Text control CKEditor
JSP pages use Rich Text controls CKEditor custom styles
JSP uses CKEditor and Ckfinder to implement rich text and upload functions
First, download CKEditor
1. Direct download address, current latest version for 3.6:http://ckeditor.com/download
Second, install CKEditor
Unzip Ckeditor_3.5.zip, get CKEditor folder, copy ckeditor entire folder to the root of project project, that is, under Webroot
Third, verify the CKEditor is installed successfully
Deployment Run project, Access: http://localhost/project name/ckeditor/_samples/index.html
You can get a demo page for the ckeditor Samples List to show that CKEditor has been installed successfully
iv. Application of CKEditor
1. Import JS file
<script type= "Text/javascript" src= "<%=request.getcontextpath ()%>/ckeditor/ckeditor.js" ></script >
2. Create and use CKEditor
<%@ page language= "java" import= "java.util.*" pageencoding= "GBK"%> <!
DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" >
Description
1 textarea attribute value name= "Content": the name can be defined arbitrarily, but must be with the following ckeditor.replace (' content '); The
2) ckeditor.replace (' content '); is the most basic notation, which represents an instance of an editor created using the CKEditor JavaScript API.
Replace the textareaabove.
To add some property settings for CKEditor, its properties must be written in the {} curly braces.
As above {toolbar: ' Full ', skin: ' Kama '}
v. Get the data in the editor
Sometimes when submitting a form, you need to determine whether the content in the editor is empty, and you can use the CKEditor JavaScript API:
CKEDITOR.instances.content.getData ()
function test () {
var editor_data = CKEDITOR.instances.content.getData ();
if (Editor_data==null | | editor_data== "") {
alert ("Please fill in the content.") ");
return false;
}
}
Note: If you play a bunch of blanks in the editor, the content is not empty because the editor will convert the spaces you have typed into
At this point, the CKEDIOTR Editor can be displayed and used on the page.
Supplemental NOTE: If you use STRUTS2 framework in your project, you can also get the contents of the editor based on the TEXTAREA properties name= above, preferably using a blob for storage.