欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

FCKeditor使用说明

程序员文章站 2022-06-03 14:33:21
...
开发环境:
    Tomcat5.5   Eclipse3.2

FCKeditor 版本 FCKeditor_2.3.1  FCKeditor.Java 2.3

下载地址: http://www.fckeditor.net/download/default.html

开始:

新建工程,名称为 fekeditor
解压 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 代码如下:

<%@ page contentType = "text/html;charset=UTF-8" language = "java" %>
<%@ taglib uri = "/WEB-INF/FCKeditor.tld" prefix = "fck" %><html>
  <head>
    <title> Test </title>
  </head>  <body>
    <FORM action = "jsp2.jsp" >
    <fck:editor id = "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"
 imageUploadURL = "/fekeditor/editor/filemanager/upload/simpleuploader?Type=Image"
    linkUploadURL = "/fekeditor/editor/filemanager/upload/simpleuploader?Type=File"
 flashUploadURL = "/fekeditor/editor/filemanager/upload/simpleuploader?Type=Flash" >
  </fck:editor>
  <input type="submit" />
    </FORM>
  </body>
</html>jsp2.jsp 代码如下:<html>
  <head>
    <title>TEST</title>
  </head>  <body>
    <%=request.getParameter( "testfck" )%>
  </body>
</html>

在 WebContent 目录下新建 UserFiles 文件夹,在此文件夹下新建 File,Image,Flash 三个文件夹。

ok现在运行一下看看吧!
                                      参考http://www.blogjava.net/oksonic/archive/2006/05/11/45687.aspx