FCKeditor在线文本编辑器的使用说明
FCKeditor 版本:
FCKeditor_2.3.1
FCKeditor.Java 2.3
开始:
新建工程,名称为 fekeditor
解压 FCKeditor_2.3.1 包中的 edit 文件夹到项目中的 WebContent 目录
解压 FCKeditor_2.3.1 包中的 edit 文件夹到项目中的 WebContent 目录
解压 FCKeditor_2.3.1 包中的 fckconfig.js、fckeditor.js、fckstyles.xml、fcktemplates.xml 文件夹到项目中的 WebContent 目录
解压 FCKeditor-2.3.zip 包中的 \web\WEB-INF\lib 下的两个 jar 文件到项目的 WebContent\WEB-INF\lib 目录
解压 FCKeditor-2.3.zip 包中的 \src 下的 FCKeditor.tld 文件到项目的 WebContent\WEB-INF 目录
删除 WebContent\edit 目录下的 _source 文件夹
修改 web.xml 文件,加入以下内容:
- <servlet>
- <servlet-name>Connector</servlet-name>
- <servlet-class>
- com.fredck.FCKeditor.connector.ConnectorServlet
- </servlet-class>
- <init-param>
- <param-name>baseDir</param-name>
- <!--此为文件浏览路径-->
- <param-value>/UserFiles/</param-value>
- </init-param>
- <init-param>
- <param-name>debug</param-name>
- <param-value>true</param-value>
- </init-param>
- <load-on-startup>1</load-on-startup>
- </servlet><servlet>
- <servlet-name>SimpleUploader</servlet-name>
- <servlet-class>
- com.fredck.FCKeditor.uploader.SimpleUploaderServlet
- </servlet-class>
- <init-param>
- <param-name>baseDir</param-name>
- <!--此为文件上传路径,需要在WebContent目录下新建UserFiles文件夹-->
- <!--根据文件的类型还需要新建相关的文件夹Image、Flash-->
- <param-value>/UserFiles/</param-value>
- </init-param>
- <init-param>
- <param-name>debug</param-name>
- <param-value>true</param-value>
- </init-param>
- <init-param>
- <!--此参数为是否开启上传功能-->
- <param-name>enabled</param-name>
- <param-value>false</param-value>
- </init-param>
- <init-param>
- <param-name>AllowedExtensionsFile</param-name>
- <param-value></param-value>
- </init-param>
- <init-param>
- <!--此参数为文件过滤,以下的文件类型都不可以上传-->
- <param-name>DeniedExtensionsFile</param-name>
- <param-value>
- php|php3|php5|phtml|asp|aspx|ascx|jsp|cfm|cfc|pl|bat|exe|dll|reg|cgi
- </param-value>
- </init-param>
- <init-param>
- <param-name>AllowedExtensionsImage</param-name>
- <param-value>jpg|gif|jpeg|png|bmp</param-value>
- </init-param>
- <init-param>
- <param-name>DeniedExtensionsImage</param-name>
- <param-value></param-value>
- </init-param>
- <init-param>
- <param-name>AllowedExtensionsFlash</param-name>
- <param-value>swf|fla</param-value>
- </init-param>
- <init-param>
- <param-name>DeniedExtensionsFlash</param-name>
- <param-value></param-value>
- </init-param>
- <load-on-startup>1</load-on-startup>
- </servlet><servlet-mapping>
- <servlet-name>Connector</servlet-name>
- <url-pattern>
- /editor/filemanager/browser/default/connectors/jsp/connector
- </url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>SimpleUploader</servlet-name>
- <url-pattern>
- /editor/filemanager/upload/simpleuploader
- </url-pattern>
- </servlet-mapping>
新建一个提交页 jsp1.jsp 文件和一个接收页 jsp2.jsp 文件
jsp1.jsp文件:
- <%@pagecontentType="text/html;charset=UTF-8"language="java"%>
- <%@tagliburi="/WEB-INF/FCKeditor.tld"prefix="fck"%>
- <html>
- <head>
- <title>Test</title>
- </head>
- <body>
- <FORMaction="jsp2.jsp">
- <fck:editorid="testfck"basePath="/fekeditor/"
- height="100%"
- skinPath="/fekeditor/editor/skins/default/"
- toolbarSet="Default"
- imageBrowserURL="/fekeditor/editor/filemanager/browser/
- default/browser.html?Type=Image&Connector=connectors/jsp/connector"
- linkBrowserURL="/fekeditor/editor/filemanager/browser/
- default/browser.html?Connector=connectors/jsp/connector"
- flashBrowserURL="/fekeditor/editor/filemanager/browser/
- default/browser.html?Type=Flash&Connector=connectors/jsp/
- connector"
20.
imageUploadURL="/fekeditor/editor/filemanager/upload/
21.
simpleuploader?Type=Image"
- linkUploadURL="/fekeditor/editor/filemanager/upload/
- simpleuploader?Type=File"
- flashUploadURL="/fekeditor/editor/filemanager/upload/
- simpleuploader?Type=Flash">
- </fck:editor>
- <inputtype="submit"/>
- </FORM>
- </body>
- </html>
jsp2.jsp
代码如下:
- <html>
- <head>
- <title>TEST</title>
- </head>
- <body>
- <%=request.getParameter("testfck")%>
- </body>
- </html>
在 WebContent 目录下新建 UserFiles 文件夹,在此文件夹下新建 File,Image,Flash 三个文件夹,为上传文件存储目录。
注:File,Image,Flash三个文件夹:可以不用建,系统在你上传文件的同时自动创建。