posts - 0, comments - 77, trackbacks - 0, articles - 356
            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

          FCKeditor_2.3.2 在線網頁編輯器(Java)

          Posted on 2007-06-10 15:44 semovy 閱讀(844) 評論(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里修改,該怎么傳參數?
          主站蜘蛛池模板: 新昌县| 台湾省| 久治县| 商丘市| 台南市| 周至县| 乌什县| 内江市| 绥江县| 龙州县| 通化市| 巴马| 浪卡子县| 化州市| 平山县| 平塘县| 五常市| 延川县| 扬中市| 万年县| 西藏| 丰台区| 石门县| 花莲县| 泰顺县| 周口市| 茂名市| 工布江达县| 建德市| 微山县| 绩溪县| 郎溪县| 安庆市| 克东县| 勃利县| 祥云县| 嘉祥县| 肃宁县| 拜城县| 阳朔县| 阳曲县|