日期:2014-05-16  浏览次数:20290 次

JSP环境中FCKeditor的下载安装指南
FCKeditor是sourceforge.net上面的一个开源项目,主要是实现在线网页编辑器的功能,可以让web程序拥有如MS Word这样强大的编辑功能。官方网站为http://www.fckeditor.net ,在服务器端支持ASP.Net、ASP、ClodFusion、PHP、Java等语言,并且支持IE 5+、Mozilla 、Netscape等主流浏览器。

  首先在官方网站下载fckeditor,注意有两个包,一个是主文件,一个是jsp整合包的。

  1、解压FCKeditor_2.4.2.zip,(FCKeditor主文件),将FCKeditor目录复制到网站根目录下,

      下载地址:下面附件中有

  2、解压FCKeditor-2.3.zip,(jsp,FCKeditor整合包),作用:This is the JSP Integration Pack for using FCKeditor inside a java server page without the complexity of using a Java scriptlets or the javascript api.

      下载地址:下面附件有

  3、将FCKeditor-2.3/web/WEB-INF/web.xml中的两个servlet,servlet-mapping定义复制到自已项目的web.xml文件中并修改

    修改结果:

<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>

然后加入如下内容

<taglib>
   <taglib-uri>/FCKeditor</taglib-uri>
   <taglib-location>/WEB-INF/FCKeditor.tld</taglib-location>
</taglib>

  4、然后我们将FCKeditor-2.3\web\WEB-INF\lib中的两个jar包拷贝到\fcktest\WEB-INF\lib目录下,将FCKeditor-2.3\src下的FCKeditor.tld拷贝到\fcktest\WEB-INF下。
  5、在需使用FCKeditor的jsp界面中加入:

// 文件开头处加入

<%@ taglib uri="/FCKeditor" prefix="FCK" %>

  //要使用的地方加入

<FCK:editor id="EditorAccessibility"
        width="80%" height="320"
        fontNames="宋体;黑体;隶书;楷体_GB2312;Arial;Comic Sans MS;Courier
New;Tahoma;Times New Roman;Verdana"
    
imageBrowserURL="/fkctest/FCKeditor/editor/filemanager/browser/default/browser.html?
Type=Image&Connector=connectors/jsp/connector"
  
linkBrowserURL="/fkctest/FCKeditor/editor/filemanager/browser/default/browser.html?
Connector=connectors/jsp/connector"
  
flashBrowserURL="/fkctest/FCKeditor/editor/filemanager/browser/default/browser.html?
Type=Flash&Connector=connectors/jsp/connector"
  
imageUploadURL="/fkctest/FCKeditor/editor/filemanager/upload/simpleuploader?Type=Image"
  
linkUploadURL="/fkctest/FCKeditor/editor/filemanager/upload/simpleuploader?Type=File"
  
flashUploadURL="/fkctest/FCKeditor/editor/filemanager/upload/simpleuploader?Type=Flash">
  
   </FCK:editor>
<FCK:editor id="EditorAccessibility"
      width="80%" height="320"
      fontNames="宋体;黑体;隶书;楷体_GB2312;Arial;Comic Sans MS;Courier
New;Tahoma;Times New Roman;Verdana"
    
imageBrowserURL="/fkctest/FCKeditor/editor/filemanager/browser/default/browser.html?
Type=Image&Connector=connectors/jsp/connector"
  
linkBrowserURL="/fkctest/FCKeditor/editor/filemanager/browser/default/browser.html?
Connector=connectors/jsp/connector"
  
flashBrowserURL="/fkctest/FCKeditor/editor/filemanager/browser/default/browser.html?
Type=Flash&Connector=connectors/jsp/connector"
  
imageUploadURL="/fkctest/FCKeditor/editor/filemanager/upload/simpleuploader?Type=Image"
  
linkUploadURL="/fkctest/FCKeditor/editor/filemanager/upload/simpleuploader?Type=File"
  
flashUploadURL="/fkctest/FCKeditor/editor/filemanager/upload/simpleuploader?Type=Flash">