posts - 0, comments - 77, trackbacks - 0, articles - 356
  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

FCKeditor_2.3.2 在线网页编辑器(Java)

Posted on 2007-06-10 15:44 semovy 阅读(835) 评论(1)  编辑  收藏 所属分类: J2EE综合

/******************************************
*Author:Java619
*Time:20070515
*******************************************/

首先下载相关文件

FCKeditor_2.3.2.zip

http://prdownloads.sourceforge.net/fckeditor/FCKeditor_2.3.2.zip?download

FCKeditor-2.3 (for java)

http://nchc.dl.sourceforge.net/sourceforge/fckeditor/FCKeditor-2.3.zip

1> 下载完成后,在J2EE应用中,建立项目:fcktest,在应用根目录中建立文件夹FCKeditor,将FCKeditor中的editor目录及 fckconfig.js、fckeditor.js、fckstyles.xml、fcktemplates.xml文件拷贝到FCKeditor目录下。

2> 然后我们将FCKeditor-2.3\web\WEB-INF\lib中的两个jar包拷贝到\fcktest\WEB-INF\lib目录下,将 FCKeditor-2.3\src下的FCKeditor.tld拷贝到\fcktest\WEB-INF下。

3> 编辑\fcktest\WEB-INF\web.xml文件,将FCKeditor-2.3\web\WEB-INF\web.xml里的内容合并到项目的\WEB-INF\目录下的web.xml文件中,修改<servlet-mapping>里的内容为:

    <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>  修改合并后的web.xml文件,将名为SimpleUploader的Servlet的enabled参数值改为true,以允许上传功能,Connector Servlet的baseDir参数值用于设置上传文件存放的位置。
    并添加下面内容

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

5>修改页面fckconfig.js

将FCKConfig.LinkBrowserURL等的值替换成以下内容:
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> 添加页面 index.jsp

<%@page contentType="text/html;charset=UTF-8"%>
<%@page pageEncoding="UTF-8"%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        <script type="text/javascript" src="FCKeditor/fckeditor.js"></script>
    </head>
    <body>
        <form action="sampleposteddata.jsp" method="post" target="_blank">
        <table border="0" width="700"><tr><td>
        <textarea id="content" name="content" style="WIDTH: 100%; HEIGHT: 400px"></textarea>
        <script type="text/javascript">
        var oFCKeditor = new FCKeditor('content') ;
        oFCKeditor.BasePath = "FCKeditor/" ;
        oFCKeditor.Height = 400; 
        oFCKeditor.ReplaceTextarea();
        </script>
        <input type="submit" value="Submit">
        </td></tr></table>
      </form>
    </body>
</html>

7>  添加接受页面sampleposteddata.jsp

<%@ page contentType="text/html;charset=UTF-8"%>
      <%@ page language="java" import="java.util.*" %>
      <%
        Enumeration params = request.getParameterNames();
      %>
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
      <html>
        <head>
          <title>FCKeditor - Samples - Posted Data</title>
          <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
          <meta name="robots" content="noindex, nofollow">
          <link href="../sample.css" rel="stylesheet" type="text/css" />
        </head>
        <body>
          <h1>FCKeditor中国的中 - Samples - Posted Data</h1>
          This page lists all data posted by the form.
          <hr>
          <table width="100%" border="1" cellspacing="0" bordercolor="#999999">
            <tr style="FONT-WEIGHT: bold; COLOR: #dddddd; BACKGROUND-COLOR: #999999">
            
  <td noWrap>Field Name&nbsp;&nbsp;</td>
              <td>Value</td>
            </tr>
            <%
            String parameter = null ;
            while( params.hasMoreElements() )
            {
              parameter = (String) params.nextElement() ;
            %>
            <tr>
              <td valign="top" nowrap><b><%=parameter%></b></td>
              <td width="100%"><%=request.getParameter(parameter)%></td>
            </tr>
            <%
            }
            %>
          </table>
        </body>
      </html>
     


评论

# re: FCKeditor_2.3.2 在线网页编辑器(Java) [未登录]  回复  更多评论   

2010-12-03 15:23 by java
如果我想把一个网页的内容传到FCKeditor里修改,该怎么传参数?

只有注册用户登录后才能发表评论。


网站导航: