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

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值