http://blog.csdn.net/skyman1942/article/details/52537100
1. Environment Description:
Date: 2016-09-14
Tool: ckeditor_4.5.11+ckfinder_java_2.6.2
Environment: i5-3210m,8g DDR3,WIN10 x64,jdk1.8 x64
Development tools: Eclipse Neon x64 (the Web plugin that may be used is not mentioned here)
2. Tool Pack:
Ckeditor_4.5.11_full.zip,ckfinder_java_2.6.2.zip,ckeditor-java-core-3.5.3.zip, three compressed packages can be downloaded to the official website.
3. Introduction of tools to Web Engineering (1) CKEditor
Ckeditor_4.5.11_full.zip Extract the CKEditor directory, which is structured as follows: Copy the CKEditor to the Web project WebContent directory
(4) Ckfinder
Ckfinder_java_2.6.2.zip Decompression, get the directory there is a Ckfinderjava-2.6.2.war, unzip the war into a directory, its structure is as follows: Copy the Ckfinder directory to the Web project WEBC ontent directory, copy CONFIG. xml under the Web-inf directory into the webcontent/web-inf/directory under the WEB project and rename it to Ckfinder.xml to differentiate between the others
(5) Jar Package Introduction
1) in step (4) in the War decompression directory, all jar packages under the Web-inf/lib directory are copied to the Webcontent/web-inf/lib directory of the WEB project; 2) Ckeditor-java-core-3.5.3.zip Unzip to get a directory that Ckeditor-java-core-3.5.3.jar copied to the WEB project's Webcontent/web-inf/lib directory. Here, Web engineering webcontent directory structure such as:
(6) Toolkit refinement (in engineering)
CKEditor:
The lang directory holds internationalized files, usually only en.js and zh-cn.js;
Samples directory is the instance, delete the directory;
3 md suffix for file deletion.
Ckfinder:
_samples directory deletion;
Help directory deletion;
Lang language files, reserved en.js and zh-cn.js;
4 txt text deleted.
(Note: Further refinement is possible, please refer to other tutorials)
4, Configuration CKEditor config.js file (in the project)
Open the Config.js in the CKEditor directory;
Here is a reference, where the configuration of the Ckfinder is required
[HTML]View Plain Copy
- Ckeditor.editorconfig = Function (config) {
- Define changes to the default configuration here. For example:
- config.language = ' fr ';
- Config.uicolor = ' #FF0000 ';
- /*
- config.toolbar_full = [
- [' Source ', '-', ' Save ', ' NewPage ', ' Preview ', '-', ' Templates '],
- [' Cut ', ' Copy ', ' Paste ', ' pastetext ', ' Pastefromword ', '-', ' Print ', ' spellchecker ', ' Scayt '],
- [' Undo ', ' Redo ', '-', ' Find ', ' Replace ', '-', ' selectall ', ' Removeformat '],
- [' Form ', ' Checkbox ', ' Radio ', ' TextField ', ' Textarea ', ' Select ', ' Button ', ' ImageButton ', ' HiddenField '],
- ‘/‘,
- [' Bold ', ' Italic ', ' underline ', ' Strike ', '-', ' subscript ', ' superscript '],
- [' Numberedlist ', ' BulletedList ', '-', ' outdent ', ' Indent ', ' Blockquote '],
- [' Justifyleft ', ' justifycenter ', ' justifyright ', ' Justifyblock '],
- [' Link ', ' Unlink ', ' Anchor '],
- [' Image ', ' Flash ', ' Table ', ' horizontalrule ', ' Smiley ', ' Specialchar ', ' pagebreak '],
- ‘/‘,
- [' Styles ', ' Format ', ' Font ', ' FontSize '],
- [' TextColor ', ' BGColor ']
- ];
- */
- Cancel edit box drag and Drop zoom
- config.resize_enabled=false;
- Filebrowserbrowseurl = '/ckfinder/ckfinder.html ';
- Filebrowserimagebrowseurl = '/ckfinder/ckfinder.html?type=images ';
- Filebrowserflashbrowseurl = '/ckfinder/ckfinder.html?type=flash ';
- Filebrowseruploadurl = '/ckfinder/core/connector/java/connector.java?command=quickupload&type=files ' ;
- Filebrowserimageuploadurl = '/ckfinder/core/connector/java/connector.java?command=quickupload&type= Images ';
- Filebrowserflashuploadurl = '/ckfinder/core/connector/java/connector.java?command=quickupload&type= Flash ';
- };
5, configuration Ckfinder.xml
Open the Ckfinder.xml in the Web-inf directory.
1) <enabled>true</enabled>,true means open cfinder.
2) <baseurl>http://localhost:8080/model2message/upload/</baseurl>, this tag specifies the directory where the file is uploaded,
Tomcat Server access address + project name + Receive folder + "/", I created a upload directory under the project's publishing path, so this is the access path.
3) User access rights are set under the Accesscontrols tab,
[HTML]View Plain Copy
- <accesscontrols>
- <AccessControl>
- <role>*</role>
- <resourcetype>*</resourcetype>
- <folder>/</folder>
- <folderview>true</folderview>
- <foldercreate>true</foldercreate>
- <folderrename>true</folderrename>
- <folderdelete>false</folderdelete>
- <fileview>true</fileview>
- <fileUpload>true</fileUpload>
- <filerename>true</filerename>
- <filedelete>false</filedelete>
- </AccessControl>
- </accesscontrols>
6. Configure Web. xml
you can refer to Web. XML under the Web-inf directory in the Extract directory of the war in Step 3-(4)
.
[HTML]View Plain Copy
- <servlet>
- <servlet-name>connectorservlet</servlet-name>
- <servlet-class>com.ckfinder.connector.connectorservlet</servlet-class>
- <init-param>
- <param-name>xmlconfig</param-name>
- <span style="color: #ff0000;" ><param-value>/web-inf/ckfinder.xml</param-value><!- -ckfinder.xml is renamed CONFIG.</span>
- </init-param>
- <init-param>
- <param-name>debug</param-name>
- <param-value>false</param-value>
- </init-param>
- <load-on-startup>1</load-on-startup>
- </servlet>
- <servlet-mapping>
- <servlet-name>connectorservlet</servlet-name>
- <url-pattern>/ckfinder/core/connector/java/connector.java</url-pattern>
- </servlet-mapping>
7. Use on JSP page
This is created using tags.
<%@ taglib uri= "http://ckeditor.com" prefix= "ce"%>
<%@ taglib uri= "Http://cksource.com/ckfinder" prefix= "CF"%>
Note that the Ckfinder label should be placed before the ckeditor tag.
<cf:setupckeditor editor= "ed1" basepath= "/model2message/ckfinder/"/>
<ce:editor editor= "ed1" basepath= "/model2message/ckeditor/" ></ce:editor>
Note: The above simple configuration, need to achieve more features, please refer to other tutorials, thank you message.
ckeditor4.5.11+ckfinder_java2.6.2 Configuration