FCKeditor使用说明
开发环境:
Tomcat6.0 MyEclipse 5.1.1
FCKeditor 版本 FCKeditor_2.5 FCKeditor.Java 2.3
下载地址: http://www.fckeditor.net/download/default.html
开始:
新建工程,名称为 FCKeditor
解压 FCKeditor_2.5 包中的 edit 文件夹到项目中的 WebRoot\fck目录
解压 FCKeditor_2.5 包中的 fckconfig.js、fckeditor.js、fckstyles.xml、fcktemplates.xml 文件夹到项目中的 WebRoot\fck目录
解压 FCKeditor-2.3.zip 包中的 \web\WEB-INF\lib 下的两个 jar 文件到项目的 WebRoot\WEB-INF\lib 目录
解压 FCKeditor-2.3.zip 包中的 \src 下的 FCKeditor.tld 文件到项目的 WebContent\WEB-INF 目录
刷新一下工程,有一个文件会出错,不管它是什么错,将错误信息清除
删除 WebContent\edit 目录下的 _source 文件夹
修改 web.xml 文件,加入以下内容
代码
1
<
servlet
>
2 < servlet - name > Connector </ servlet - name >
3 < servlet - class > com.fredck.FCKeditor.connector.ConnectorServlet </ servlet - class >
4 < init - param >
5 < param - name > baseDir </ param - name >
6 <!-- 此为文件浏览路径 -->
7 < param - value >/ UserFiles /</ param - value >
8 </ init - param >
9 < init - param >
10 < param - name > debug </ param - name >
11 < param - value > true </ param - value >
12 </ init - param >
13 < load - on - startup > 1 </ load - on - startup >
14 </ servlet >
15
16 < servlet >
17 < servlet - name > SimpleUploader </ servlet - name >
18 < servlet - class > com.fredck.FCKeditor.uploader.SimpleUploaderServlet </ servlet - class >
19
20 < init - param >
21 < param - name > baseDir </ param - name >
22 <!-- 此为文件上传路径,需要在WebRoot 目录下新建 UserFiles 文件夹 -->
23 <!-- 根据文件的类型还需要新建相关的文件夹 Image、 Flash -->
24 < param - value >/ UserFiles /</ param - value >
25 </ init - param >
26 < init - param >
27 < param - name > debug </ param - name >
28 < param - value > true </ param - value >
29 </ init - param >
30 < init - param >
31 <!-- 此参数为是否开启上传功能 -->
32 < param - name > enabled </ param - name >
33 < param - value > false </ param - value >
34 </ init - param >
35 < init - param >
36 < param - name > AllowedExtensionsFile </ param - name >
37 < param - value ></ param - value >
38 </ init - param >
39 < init - param >
40 <!-- 此参数为文件过滤,以下的文件类型都不可以上传 -->
41 < param - name > DeniedExtensionsFile </ param - name >
42 < param - value > php | php3 | php5 | phtml | asp | aspx | ascx | jsp | cfm | cfc | pl | bat | exe | dll | reg | cgi </ param - value >
43 </ init - param >
44 < init - param >
45 < param - name > AllowedExtensionsImage </ param - name >
46 < param - value > jpg | gif | jpeg | png | bmp </ param - value >
47 </ init - param >
48 < init - param >
49 < param - name > DeniedExtensionsImage </ param - name >
50 < param - value ></ param - value >
51 </ init - param >
52 < init - param >
53 < param - name > AllowedExtensionsFlash </ param - name >
54 < param - value > swf | fla </ param - value >
55 </ init - param >
56 < init - param >
57 < param - name > DeniedExtensionsFlash </ param - name >
58 < param - value ></ param - value >
59 </ init - param >
60 < load - on - startup > 1 </ load - on - startup >
61 </ servlet >
62
63 < servlet - mapping >
64 < servlet - name > Connector </ servlet - name >
65 < url - pattern >/ FCKeditor / fck / editor / filemanager / browser / default / connectors / jsp / connector </ url - pattern >
66 </ servlet - mapping >
67
68 < servlet - mapping >
69 < servlet - name > SimpleUploader </ servlet - name >
70 < url - pattern >/ FCKeditor / fck / editor / filemanager / upload / simpleuploader </ url - pattern >
71 </ servlet - mapping >
2 < servlet - name > Connector </ servlet - name >
3 < servlet - class > com.fredck.FCKeditor.connector.ConnectorServlet </ servlet - class >
4 < init - param >
5 < param - name > baseDir </ param - name >
6 <!-- 此为文件浏览路径 -->
7 < param - value >/ UserFiles /</ param - value >
8 </ init - param >
9 < init - param >
10 < param - name > debug </ param - name >
11 < param - value > true </ param - value >
12 </ init - param >
13 < load - on - startup > 1 </ load - on - startup >
14 </ servlet >
15
16 < servlet >
17 < servlet - name > SimpleUploader </ servlet - name >
18 < servlet - class > com.fredck.FCKeditor.uploader.SimpleUploaderServlet </ servlet - class >
19
20 < init - param >
21 < param - name > baseDir </ param - name >
22 <!-- 此为文件上传路径,需要在WebRoot 目录下新建 UserFiles 文件夹 -->
23 <!-- 根据文件的类型还需要新建相关的文件夹 Image、 Flash -->
24 < param - value >/ UserFiles /</ param - value >
25 </ init - param >
26 < init - param >
27 < param - name > debug </ param - name >
28 < param - value > true </ param - value >
29 </ init - param >
30 < init - param >
31 <!-- 此参数为是否开启上传功能 -->
32 < param - name > enabled </ param - name >
33 < param - value > false </ param - value >
34 </ init - param >
35 < init - param >
36 < param - name > AllowedExtensionsFile </ param - name >
37 < param - value ></ param - value >
38 </ init - param >
39 < init - param >
40 <!-- 此参数为文件过滤,以下的文件类型都不可以上传 -->
41 < param - name > DeniedExtensionsFile </ param - name >
42 < param - value > php | php3 | php5 | phtml | asp | aspx | ascx | jsp | cfm | cfc | pl | bat | exe | dll | reg | cgi </ param - value >
43 </ init - param >
44 < init - param >
45 < param - name > AllowedExtensionsImage </ param - name >
46 < param - value > jpg | gif | jpeg | png | bmp </ param - value >
47 </ init - param >
48 < init - param >
49 < param - name > DeniedExtensionsImage </ param - name >
50 < param - value ></ param - value >
51 </ init - param >
52 < init - param >
53 < param - name > AllowedExtensionsFlash </ param - name >
54 < param - value > swf | fla </ param - value >
55 </ init - param >
56 < init - param >
57 < param - name > DeniedExtensionsFlash </ param - name >
58 < param - value ></ param - value >
59 </ init - param >
60 < load - on - startup > 1 </ load - on - startup >
61 </ servlet >
62
63 < servlet - mapping >
64 < servlet - name > Connector </ servlet - name >
65 < url - pattern >/ FCKeditor / fck / editor / filemanager / browser / default / connectors / jsp / connector </ url - pattern >
66 </ servlet - mapping >
67
68 < servlet - mapping >
69 < servlet - name > SimpleUploader </ servlet - name >
70 < url - pattern >/ FCKeditor / fck / editor / filemanager / upload / simpleuploader </ url - pattern >
71 </ servlet - mapping >
新建一个提交页 test.jsp 文件和一个接收页 show.jsp 文件
test.jsp 代码如下:
代码
1
<%
@ page contentType
=
"
text/html;charset=UTF-8
"
language
=
"
java
"
%>
2 <% @ taglib uri = " /WEB-INF/FCKeditor.tld " prefix = " fck " %>< html >
3 < head >
4 < title > Test </ title >
5 </ head > < body >
6 < FORM action = " test1.jsp " >
7 < fck:editor id = " testfck " basePath = " /FCKeditor/fck/ "
8 height = " 100% "
9 skinPath = " /FCKeditor/fck/editor/skins/default/ "
10 toolbarSet = " Default "
11 imageBrowserURL = " /FCKeditor/fck/editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector "
12 linkBrowserURL = " /FCKeditor/fck/editor/filemanager/browser/default/browser.html?Connector=connectors/jsp/connector "
13 flashBrowserURL = " /FCKeditor/fck/editor/filemanager/browser/default/browser.html?Type=Flash&Connector=connectors/jsp/connector "
14 imageUploadURL = " /FCKeditor/fck/editor/filemanager/upload/simpleuploader?Type=Image "
15 linkUploadURL = " /FCKeditor/fck/editor/filemanager/upload/simpleuploader?Type=File "
16 flashUploadURL = " /FCKeditor/fck/editor/filemanager/upload/simpleuploader?Type=Flash " >
17 </ fck:editor >
18 < input type = " submit " />
19 </ FORM >
20 </ body >
21 </ html >
2 <% @ taglib uri = " /WEB-INF/FCKeditor.tld " prefix = " fck " %>< html >
3 < head >
4 < title > Test </ title >
5 </ head > < body >
6 < FORM action = " test1.jsp " >
7 < fck:editor id = " testfck " basePath = " /FCKeditor/fck/ "
8 height = " 100% "
9 skinPath = " /FCKeditor/fck/editor/skins/default/ "
10 toolbarSet = " Default "
11 imageBrowserURL = " /FCKeditor/fck/editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector "
12 linkBrowserURL = " /FCKeditor/fck/editor/filemanager/browser/default/browser.html?Connector=connectors/jsp/connector "
13 flashBrowserURL = " /FCKeditor/fck/editor/filemanager/browser/default/browser.html?Type=Flash&Connector=connectors/jsp/connector "
14 imageUploadURL = " /FCKeditor/fck/editor/filemanager/upload/simpleuploader?Type=Image "
15 linkUploadURL = " /FCKeditor/fck/editor/filemanager/upload/simpleuploader?Type=File "
16 flashUploadURL = " /FCKeditor/fck/editor/filemanager/upload/simpleuploader?Type=Flash " >
17 </ fck:editor >
18 < input type = " submit " />
19 </ FORM >
20 </ body >
21 </ html >
show.jsp 代码如下:
1
<%
@ page contentType
=
"
text/html;charset=UTF-8
"
language
=
"
java
"
%>
2 <% @ taglib uri = " /WEB-INF/FCKeditor.tld " prefix = " fck " %>< html >
3 < head >
4 < title > Test </ title >
5 </ head > < body >
6 < FORM action = " test1.jsp " >
7 < fck:editor id = " testfck " basePath = " /FCKeditor/fck/ "
8 height = " 100% "
9 skinPath = " /FCKeditor/fck/editor/skins/default/ "
10 toolbarSet = " Default "
11 imageBrowserURL = " /FCKeditor/fck/editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector "
12 linkBrowserURL = " /FCKeditor/fck/editor/filemanager/browser/default/browser.html?Connector=connectors/jsp/connector "
13 flashBrowserURL = " /FCKeditor/fck/editor/filemanager/browser/default/browser.html?Type=Flash&Connector=connectors/jsp/connector "
14 imageUploadURL = " /FCKeditor/fck/editor/filemanager/upload/simpleuploader?Type=Image "
15 linkUploadURL = " /FCKeditor/fck/editor/filemanager/upload/simpleuploader?Type=File "
16 flashUploadURL = " /FCKeditor/fck/editor/filemanager/upload/simpleuploader?Type=Flash " >
17 </ fck:editor >
18 < input type = " submit " />
19 </ FORM >
20 </ body >
21 </ html >
2 <% @ taglib uri = " /WEB-INF/FCKeditor.tld " prefix = " fck " %>< html >
3 < head >
4 < title > Test </ title >
5 </ head > < body >
6 < FORM action = " test1.jsp " >
7 < fck:editor id = " testfck " basePath = " /FCKeditor/fck/ "
8 height = " 100% "
9 skinPath = " /FCKeditor/fck/editor/skins/default/ "
10 toolbarSet = " Default "
11 imageBrowserURL = " /FCKeditor/fck/editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector "
12 linkBrowserURL = " /FCKeditor/fck/editor/filemanager/browser/default/browser.html?Connector=connectors/jsp/connector "
13 flashBrowserURL = " /FCKeditor/fck/editor/filemanager/browser/default/browser.html?Type=Flash&Connector=connectors/jsp/connector "
14 imageUploadURL = " /FCKeditor/fck/editor/filemanager/upload/simpleuploader?Type=Image "
15 linkUploadURL = " /FCKeditor/fck/editor/filemanager/upload/simpleuploader?Type=File "
16 flashUploadURL = " /FCKeditor/fck/editor/filemanager/upload/simpleuploader?Type=Flash " >
17 </ fck:editor >
18 < input type = " submit " />
19 </ FORM >
20 </ body >
21 </ html >
在 WebRoot 目录下新建 UserFiles 文件夹,在此文件夹下新建 Image 和 Flash 两个文件夹
这样就可以测试了
参考http://www.blogjava.net/oksonic/archive/2006/05/11/45687.aspx