上个项目用过的知识点总计:
一.需要的资源:
用到的网站,文件自己下载:
a) ckeditor_3.6.2 (解压)
b) ckeditor-java-3.6.2 (解压)
c) ckfinder_java_2.1 (解压)
推荐到官网下载最新版本 :http://ckeditor.com/download
二. 执行步骤:
1. MyEclipse新建 Web Project : CKEditor_Finder
2. 复制以下文件夹到WebRoot下面:
ckfinder_java_2.1\ckfinder\ CKFinderJava \ckfinder
注意:CKFinder 加粗的是 war 包解压后的文件夹的名称
ckeditor_3.6.2/ckeditor
3. 复制 CKFinder配置文件 到WEB-INF 下面:
ckfinder_java_2.1\ckfinder\CKFinderJava\WEB-INF\config.xml
4. 复制下面文件夹下面所有jar 文件到 WEB-INf/lib 下面:
ckfinder_java_2.1\ckfinder\CKFinderJava\WEB-INF\lib
ckeditor-java-3.6.2\WEB-INF\lib
三. 下面删除无用的文件
首先是ckeditor 下面的文件:
_sample,_source, CHANGES.html, ckeditor_php4.php , ckeditor_php5.php,
ckeditor.asp, ckeditor.pack, INSTALL.html, LICENSE.html
然后是ckfinder 下面的文件:
_samples, help, changelog.txt, install.txt, license.txt, translation.txt
四. 修改配置文件WEB-INF下config.xml
//指定上传文件或者图片的保存地址 :CKEditor_Finder为项目名,改为你自己的。
五. 在web.xml 中增加如下代码:
com.ckfinder.connector.ConnectorServlet
/ckfinder/core/connector/java/connector.java
六. 修改ckeditor/config.js文件的内容
CKEDITOR.editorConfig = function (config) {
config.filebrowserBrowseUrl = '/CKEditor_Finder/ckfinder/ckfinder.html' ;
config.filebrowserImageBrowseUrl = '/CKEditor_Finder/ckfinder/ckfinder.html?type=Images' ;
config.filebrowserFlashBrowseUrl = '/CKEditor_Finder/ckfinder/ckfinder.html?type=Flash' ;
config.filebrowserUploadUrl = '/ckfinder/core/connector/java/connector.java?command=QuickUpload&type=Files' ;
config.filebrowserImageUploadUrl = '/ckfinder/core/connector/java/connector.java?command=QuickUpload&type=Images' ;
config.filebrowserFlashUploadUrl = '/ckfinder/core/connector/java/connector.java?command=QuickUpload&type=Flash' ;
config.filebrowserWindowWidth = '1000';
config.filebrowserWindowHeight = '700';
config.language = "zh-cn" ;
};
七. 修改index.jsp文件的内容如下:
<%@ page language = "java" import = "java.util.*" pageEncoding = "utf-8" %>
<%@ taglib uri = "http://ckfinder.com" prefix = "ckfinder" %>
<%@ taglib uri = "http://ckeditor.com" prefix = "ckeditor" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+ "://" +request.getServerName()+ ":" +request.getServerPort()+path+ "/" ;
%>
< html >
< head >
< base href = " <%= basePath %> " >
< title > 首页 title >
< meta http-equiv = "pragma" content = "no-cache" >
< meta http-equiv = "cache-control" content = "no-cache" >
< meta http-equiv = "expires" content = "0" >
< form action = "getContent" method = "get" >
< textarea cols = "80" id = "editor1" name = "editor1" rows = "10" > textarea >
< input type = "submit" value = "Submit" />
form >
< ckfinder:setupCKEditor basePath = "/CKEditor_Finder/ckfinder/" editor = "editor1" />
< ckeditor:replace replace = "editor1" basePath = "/CKEditor_Finder/ckeditor/" />