FCKEditor For JSP

1、首先登陆www.fckeditor.net/download下载FCKeditor的最新版本,需要下载2个压缩包,一个是基本应用,另一个是在为在jsp下所准备的配置。

      FCKeditor 2.6 下载地址:sourceforge.net/project/downloading.php

      FCKeditor.Java 下载地址:sourceforge.net/project/downloading.php

下载之后分别为:FCKeditor_2.6.zipFCKeditor-2.3.zip 将它们分别解压。

 

2、首先在Eclipse下建立一个新项目例如:test    即http://localhost:8080/test

     在项目中新建文件夹 FCKeditor,然后将解压后的FCKeditor_2.6下fckeditor里面的editor、fckconfig.js、fckeditor.js、fckstyles.xml、fcktemplates.xml拷贝到FCKeditor目录下

      将解压后的FCKeditor-2.3文件夹中web/WEB-INF/lib下的包拷贝到test项目的lib中。

      将FCKeditor-2.3文件夹下src下的FCKeditor.tld拷贝到test项目的WEB-INF下。

 

3、将WEB-INF下的web.xml 加入如下内容:

Xml代码 复制代码
  1. <STRONG>     <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.            <param-value>/UserFiles/</param-value>  
  7.        </init-param>  
  8.        <init-param>  
  9.            <param-name>debug</param-name>  
  10.            <param-value>true</param-value>  
  11.        </init-param>  
  12.        <load-on-startup>1</load-on-startup>  
  13.    </servlet>  
  14.   
  15.    <servlet>  
  16.        <servlet-name>SimpleUploader</servlet-name>  
  17.        <servlet-class>com.fredck.FCKeditor.uploader.SimpleUploaderServlet</servlet-class>  
  18.        <init-param>  
  19.            <param-name>baseDir</param-name>  
  20.            <param-value>/UserFiles/</param-value>  
  21.        </init-param>  
  22.        <init-param>  
  23.            <param-name>debug</param-name>  
  24.            <param-value>true</param-value>  
  25.        </init-param>  
  26.        <init-param>  
  27.            <param-name>enabled</param-name>  
  28.            <param-value>true</param-value>  
  29.        </init-param>  
  30.        <init-param>  
  31.            <param-name>AllowedExtensionsFile</param-name>  
  32.            <param-value></param-value>  
  33.        </init-param>  
  34.        <init-param>  
  35.            <param-name>DeniedExtensionsFile</param-name>  
  36.            <param-value>php|php3|php5|phtml|asp|aspx|ascx|jsp|cfm|cfc|pl|bat|exe|dll|reg|cgi</param-value>  
  37.        </init-param>  
  38.        <init-param>  
  39.            <param-name>AllowedExtensionsImage</param-name>  
  40.            <param-value>jpg|gif|jpeg|png|bmp</param-value>  
  41.        </init-param>  
  42.        <init-param>  
  43.            <param-name>DeniedExtensionsImage</param-name>  
  44.            <param-value></param-value>  
  45.        </init-param>  
  46.        <init-param>  
  47.            <param-name>AllowedExtensionsFlash</param-name>  
  48.            <param-value>swf|fla</param-value>  
  49.        </init-param>  
  50.        <init-param>  
  51.            <param-name>DeniedExtensionsFlash</param-name>  
  52.            <param-value></param-value>  
  53.        </init-param>  
  54.        <load-on-startup>1</load-on-startup>  
  55.    </servlet>  
  56.   
  57. <servlet-mapping>  
  58.     <servlet-name>Connector</servlet-name>  
  59.     <url-pattern>/FCKeditor/editor/filemanager/browser/default/connectors/jsp/connector</url-pattern>  
  60. </servlet-mapping>  
  61.   
  62. <servlet-mapping>  
  63.     <servlet-name>SimpleUploader</servlet-name>  
  64.     <url-pattern>/FCKeditor/editor/filemanager/upload/simpleuploader</url-pattern>  
  65. </servlet-mapping></STRONG>  
  1. <STRONG>     <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.            <param-value>/UserFiles/</param-value>  
  7.        </init-param>  
  8.        <init-param>  
  9.            <param-name>debug</param-name>  
  10.            <param-value>true</param-value>  
  11.        </init-param>  
  12.        <load-on-startup>1</load-on-startup>  
  13.    </servlet>  
  14.   
  15.    <servlet>  
  16.        <servlet-name>SimpleUploader</servlet-name>  
  17.        <servlet-class>com.fredck.FCKeditor.uploader.SimpleUploaderServlet</servlet-class>  
  18.        <init-param>  
  19.            <param-name>baseDir</param-name>  
  20.            <param-value>/UserFiles/</param-value>  
  21.        </init-param>  
  22.        <init-param>  
  23.            <param-name>debug</param-name>  
  24.            <param-value>true</param-value>  
  25.        </init-param>  
  26.        <init-param>  
  27.            <param-name>enabled</param-name>  
  28.            <param-value>true</param-value>  
  29.        </init-param>  
  30.        <init-param>  
  31.            <param-name>AllowedExtensionsFile</param-name>  
  32.            <param-value></param-value>  
  33.        </init-param>  
  34.        <init-param>  
  35.            <param-name>DeniedExtensionsFile</param-name>  
  36.            <param-value>php|php3|php5|phtml|asp|aspx|ascx|jsp|cfm|cfc|pl|bat|exe|dll|reg|cgi</param-value>  
  37.        </init-param>  
  38.        <init-param>  
  39.            <param-name>AllowedExtensionsImage</param-name>  
  40.            <param-value>jpg|gif|jpeg|png|bmp</param-value>  
  41.        </init-param>  
  42.        <init-param>  
  43.            <param-name>DeniedExtensionsImage</param-name>  
  44.            <param-value></param-value>  
  45.        </init-param>  
  46.        <init-param>  
  47.            <param-name>AllowedExtensionsFlash</param-name>  
  48.            <param-value>swf|fla</param-value>  
  49.        </init-param>  
  50.        <init-param>  
  51.            <param-name>DeniedExtensionsFlash</param-name>  
  52.            <param-value></param-value>  
  53.        </init-param>  
  54.        <load-on-startup>1</load-on-startup>  
  55.    </servlet>  
  56.   
  57. <servlet-mapping>  
  58.     <servlet-name>Connector</servlet-name>  
  59.     <url-pattern>/FCKeditor/editor/filemanager/browser/default/connectors/jsp/connector</url-pattern>  
  60. </servlet-mapping>  
  61.   
  62. <servlet-mapping>  
  63.     <servlet-name>SimpleUploader</servlet-name>  
  64.     <url-pattern>/FCKeditor/editor/filemanager/upload/simpleuploader</url-pattern>  
  65. </servlet-mapping></STRONG>  
     <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>
           <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>true</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>/FCKeditor/editor/filemanager/browser/default/connectors/jsp/connector</url-pattern>
</servlet-mapping>

<servlet-mapping>
    <servlet-name>SimpleUploader</servlet-name>
    <url-pattern>/FCKeditor/editor/filemanager/upload/simpleuploader</url-pattern>
</servlet-mapping>

 4、修改FCKeditor文件夹下的fckeditor.js

 

      修改第50行的FCKeditor.BasePath。

改之后:

Xml代码 复制代码
  1. 50 FCKeditor.BasePath = 'FCKeditor/' ;  
  1. 50 FCKeditor.BasePath = 'FCKeditor/' ;  
50 FCKeditor.BasePath = 'FCKeditor/' ;

 

5、修改FCKeditor文件夹下的fckconfig.js

     修改FCKConfig.DefaultLanguage、FCKConfig.LinkBrowserURL、FCKConfig.ImageBrowserURL、FCKConfig.FlashBrowserURL、

改之后:

Xml代码 复制代码
  1. FCKConfig.DefaultLanguage   = 'zh-cn' ;   
  2.   
  3. FCKConfigFCKConfig.LinkBrowserURL = FCKConfig.BasePath + "filemanager/browser/default/browser.html?Connector=connectors/jsp/connector" ;   
  4.   
  5. FCKConfigFCKConfig.ImageBrowserURL = FCKConfig.BasePath + "filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector" ;   
  6.   
  7. FCKConfigFCKConfig.FlashBrowserURL = FCKConfig.BasePath + "filemanager/browser/default/browser.html?Type=Flash&Connector=connectors/jsp/connector" ;   
  8.   
  9. FCKConfigFCKConfig.LinkUploadURL = FCKConfig.BasePath + 'filemanager/upload/simpleuploader?Type=File' ;   
  10.   
  11. FCKConfigFCKConfig.ImageUploadURL = FCKConfig.BasePath + 'filemanager/upload/simpleuploader?Type=Image' ;   
  12.   
  13. FCKConfigFCKConfig.FlashUploadURL = FCKConfig.BasePath + 'filemanager/upload/simpleuploader?Type=Flash' ;  
  1. FCKConfig.DefaultLanguage   = 'zh-cn' ;   
  2.   
  3. FCKConfigFCKConfig.LinkBrowserURL = FCKConfig.BasePath + "filemanager/browser/default/browser.html?Connector=connectors/jsp/connector" ;   
  4.   
  5. FCKConfigFCKConfig.ImageBrowserURL = FCKConfig.BasePath + "filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector" ;   
  6.   
  7. FCKConfigFCKConfig.FlashBrowserURL = FCKConfig.BasePath + "filemanager/browser/default/browser.html?Type=Flash&Connector=connectors/jsp/connector" ;   
  8.   
  9. FCKConfigFCKConfig.LinkUploadURL = FCKConfig.BasePath + 'filemanager/upload/simpleuploader?Type=File' ;   
  10.   
  11. FCKConfigFCKConfig.ImageUploadURL = FCKConfig.BasePath + 'filemanager/upload/simpleuploader?Type=Image' ;   
  12.   
  13. FCKConfigFCKConfig.FlashUploadURL = FCKConfig.BasePath + 'filemanager/upload/simpleuploader?Type=Flash' ;  
FCKConfig.DefaultLanguage   = 'zh-cn' ;

FCKConfig.LinkBrowserURL = FCKConfig.BasePath + "filemanager/browser/default/browser.html?Connector=connectors/jsp/connector" ;

FCKConfig.ImageBrowserURL = FCKConfig.BasePath + "filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector" ;

FCKConfig.FlashBrowserURL = FCKConfig.BasePath + "filemanager/browser/default/browser.html?Type=Flash&Connector=connectors/jsp/connector" ;

FCKConfig.LinkUploadURL = FCKConfig.BasePath + 'filemanager/upload/simpleuploader?Type=File' ;

FCKConfig.ImageUploadURL = FCKConfig.BasePath + 'filemanager/upload/simpleuploader?Type=Image' ;

FCKConfig.FlashUploadURL = FCKConfig.BasePath + 'filemanager/upload/simpleuploader?Type=Flash' ;

 

6、default.jsp内容如下:

Html代码 复制代码
  1. <%@ page language="java" contentType="text/html; charset=gb2312"  
  2.     pageEncoding="gb2312"%>  
  3. <%@ taglib prefix="s" uri="/struts-tags"%>  
  4. <%@ taglib prefix="fck" uri="/WEB-INF/FCKeditor.tld"%>  
  5. <%request.setCharacterEncoding("gb2312");%>  
  6. <html>  
  7. <head>  
  8. <title

你可能感兴趣的:(jsp,servlet,fckeditor,Flash,asp.net)