当前位置: 首页 > 工具软件 > FCKeditor > 使用案例 >

搞定FCKeditor

荀学文
2023-12-01

一.搞定FCKeditor
    1.下载FCKeditor_2.3(目前最新版本)
    2.下载FCKeditor-2.3(4 java的最新版本)
    3.开始解压吧
    4.建立新项目MyFCK
    5.清理FCKeditor_2.3解压开的FCKeditor文件夹
      保留如下文件,其余的格删无论。
     editor(不包括_source)、fckconfig.js、fckeditor.js、fckstyles.xml、fcktemplates.xml
      再把editor中的_source干掉。
   6. MyFCK中的目录如下:
      FCKeditor、UserFiles、test.jsp、show.jsp、WEB-INF
      其中的FCKeditor中的就是步骤5中完成的。
      UserFiles是用来上传文件夹的。其中包括Image/File/Flash三个孩子。(记住啊,要不上传的时候报错啊。嘿嘿)
      WEB-INF中的目录包括lib   web.xml   FCKeditor.tld(来自FCKeditor-2.3/src)
      lib下面有FCKeditor-2.3中解压开的FCKeditor-2.3/web/WEB-INF/lib
  7. 下面重点讲web.xml/fckconfig.js中的配置了。let's go
      1)web.xml
       全部内容如下:
       其中具体的含义自己lookup了。
       <?xml version="1.0" encoding="ISO-8859-1"?>

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">

  <display-name>Welcome to FCK</display-name>
  <description>
     Welcome to FCK
  </description>
  
        <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|tif</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>
<!-- JSPC servlet mappings start -->

<!-- JSPC servlet mappings end -->
  <taglib>
     <taglib-uri>/MyFCK</taglib-uri>
     <taglib-location>/WEB-INF/FCKeditor.tld</taglib-location>
  </taglib>

</web-app>
    
2)下面是fckconfig.js了
 我只把改动的作了截图。可以参考原来的和我改动的就可以了。

添加字体了。


如果不设置除非你想把你的服务器中的资源公布于天下大白啊。

这时用于uploade的。
哈哈 就先该这些了。嘿嘿 其余的如果e文好就可以自己try。

8.哈哈 还有test.jsp和show.jsp要介绍下。嘿嘿
show.jsp简单的很啊
<%
String content = request.getParameter("content");
System.out.println(content);
out.print(content);
%>
test.jsp复杂了些。嘿嘿
<%@ page language="java" import="com.fredck.FCKeditor.*" %>
<%@ taglib uri="/MyFCK" prefix="FCK" %>
 
<html>
        <head>
                <title>
                        展示区DIY
                </title>
<script type="text/javascript" src="/MyFCK/FCKeditor/fckeditor.js"></script>
<script language="javascript">
        function preview(){
                document.forms[0].action="show.jsp";
 
                document.forms[0].target="_blank";
        document.forms[0].submit();       

}
 
        function finish(){
                document.forms[0].action="test.jsp";
 
                document.forms[0].target="";
        document.forms[0].submit();       

        }
/script>
 
<%
tring uc = "";

if(request.getParameter("content") != null){

        uc = request.getParameter("content");

        if(session.getAttribute("contentusher") != null){

                session.removeAttribute("contentusher");

        }

        session.setAttribute("contentusher",uc);
 
                out.println("<script language='javascript'>alert('保存成功');window.close();</script>");
}

%>
/head>

body bottomMargin=0 leftMargin=0 topMargin=0 rightMargin=0>

<center>               
%--

种方法调用FCKeditor

.FCKeditor自定义标签 (必须加头文件 <%@ taglib uri="/MyFCK" prefix="FCK" %> )

.script脚本语言调用 (必须引用 脚本文件 <script type="text/javascript" src="/MyFCK/FCKeditor/fckeditor.js"></script> )

.FCKeditor API 调用 (必须加头文件 <%@ page language="java" import="com.fredck.FCKeditor.*" %> )

-%>

 


form action="show.jsp" method="post" >

FCK:editor id="content" basePath="/MyFCK/FCKeditor/"

idth="700"

eight="500"

kinPath="/MyFCK/FCKeditor/editor/skins/silver/"

oolbarSet = "Default"

 

nput

/FCK:editor>
 
<div algin=center>
         <input type="button" value="预览" οnclick="preview()">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="完成" οnclick="finish()">

</div>

/form>

 

%--

 

form action="show.jsp" method="post" target="_blank">

table border="0" width="800">

tr>

<td colspan=2>

textarea id="content" name="content" style="WIDTH: 100%; HEIGHT: 400px">input</textarea>

script type="text/javascript">

ar oFCKeditor = new FCKeditor('content') ;

FCKeditor.BasePath = "/MyFCK/FCKeditor/" ;

FCKeditor.Height = 400;

FCKeditor.ToolbarSet = "Default" ;

FCKeditor.ReplaceTextarea();

/script>


/td></tr>

tr>

<td>
 
                 <input type="button" value="预览" οnclick="preview()">
</td>

<td>

         <input type="button" value="完成" οnclick="finish()">

</td>

/tr>

/table>

</form>

-%>

 


%--


<form action="show.jsp" method="post" target="_blank">

%

CKeditor oFCKeditor ;

FCKeditor = new FCKeditor( request, "content" ) ;

FCKeditor.setBasePath( "/MyFCK/FCKeditor/" ) ;

FCKeditor.setValue( "input" );

ut.println( oFCKeditor.create() ) ;

>

br>

input type="submit" value="Submit">

/form>


-%>

</center>
</body>

9 大功告成。拷贝MyFCK到webapps下。starttomcat去看看吧。嘿嘿

 类似资料: