`

FCKeditor (jsp在线编辑器)配置总结

阅读更多

折腾了两天,从eWebEditor到CKeditor再到FCKeditor真是费足了劲了!

本人比较喜欢开源的,在网上狂搜一通最后被CKeditor强大的功能和华丽的界面吸引的五体投地~~,高高兴兴的下载了CKeditor,花费了半天的时间终于把CKeditor配置好了,结果一点图片发现连个上传图片的按钮都没有( ~~~~(>_<)~~~~ ),原来还需要一个CKfinder插件。于是又兴冲冲的跑到官网上找CKfinder,找到最后却发现就是没有java版的!!!而且这个插件好像是要收费的,哎~真是郁闷死了。

不能用CKeditor那就用FCKeditor吧,呵呵,下面牢骚归正传:

一、首先到官网下载最新版本的
       FCKeditor 2.6.5 下载地址:http://sourceforge.net/project/downloading.php?group_id=75348&filename=FCKeditor_2.6.5.zip
       FCKeditor.Java 2.6 要下的有 fckeditor-java-demo-2.6.war (示例,我觉得下载这一个就够了)
                                                       fckeditor-java-2.6-src.zip (源文件,如果你想看就下吧)
                                                       fckeditor-java-2.6-bin.zip (我下了,但没有上)

二、(1)、把FCKeditor 2.6.5 解压到WebRoot下
       (2)、解压fckeditor-java-2.6-bin.zip,把文件夹中的fckeditor-java-core-2.6.jar以及lib中的所有jar包拷贝到你的web程序的lib中,fckeditor-java-demo-2.6.war中的slf4j-simple-1.5.8.jar也要拷进去(注意:slf4j-api和slf4j-simple的版本一定要一致)。
如果你觉得麻烦,那么就从fckeditor-java-demo-2.5.war中直接将lib文件夹下的所有jar包复制到项目的lib中,我就是这么做的。
       (3)、把fckeditor-java-demo-2.6.war
中的web.xml中的servlet的配置复制到你的web程序中web.xml中。
              
<servlet>
                  <servlet-name>ConnectorServlet</servlet-name>
                 <servlet-class>net.fckeditor.connector.ConnectorServlet</servlet-class>
                 <load-on-startup>1</load-on-startup>
               </servlet>

               <servlet-mapping>
                 <servlet-name>ConnectorServlet</servlet-name>
                 <!-- Do not wrap this line otherwise Glassfish will fail to load this file -->
                 <url-pattern>/fckeditor/editor/filemanager/connectors/*</url-pattern>
              </servlet-mapping>
      
(4)、把fckeditor-java-demo-2.6.war 中的fckeditor.properties复制到你项目的src中
       (5)、通过它提供的标签库添加应用:
               在需要应用的jsp页面添加taglib:
              <%@ taglib uri="http://java.fckeditor.net" prefix="FCK"%>

       然后是引用入编辑框:
             <FCK:editor instanceName="content" basePath="/FCKeditor" > </FCK:editor>

(6)、通过iframe添加应用:
               <input id="content" name="content" value="" type="hidden" /><iframe id="content___Frame" frameborder="0" height="200" scrolling="no" width="100%" src="/dsqcb.com/fckeditor/editor/fckeditor.html?InstanceName=content&amp;Toolbar=Default"> </iframe>

             

三、新建个测试页面试一下。

<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%@ taglib uri="http://java.fckeditor.net" prefix="FCK"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <title></title>
   
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">   
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">

</head>

<body style="text-align:center;">
   
<FCK:editor instanceName="content" basePath="/fckeditor" > </FCK:editor>
</body>
</html>

四、呵呵,出来了……


看看能不能传图片……

 


哈哈,上传成功!

看看能不能浏览服务器……


 

 

呵呵,也没问题啊!

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics