LittleRain

          小雨不打傘 打傘雨不小

          JSP下FCKeditor的安裝

          ????????首先下載并解壓最新的FCKeditor到各自的目錄,一個(gè)是FCKeditor的核心文件,另一個(gè)是針對(duì)jsp的文件包
          下載地址:http://www.fckeditor.net/download

          ?????????接下來(lái)我們可以開始配置了。
          我是在eclipse下來(lái)配置的
          環(huán)境:
          jdk:1.4
          eclisp:3.12
          plugin:myeclipse4.0
          FCKeditor :FCKeditor_2.3.2
          FCKeditor.java:FCKeditor-2.3

          1.新建一個(gè)webproject,我這里取名為FCK。

          2.把FCKeditor_2.3.2目錄下的FCKeditor目錄拷貝到FCK工程的根目錄,即WebRoot目錄下。

          3.將FCKeditor-2.3\web\WEB-INF目錄下的web.xml中的兩個(gè)servlet,servlet-mapping定義復(fù)制到工程的web.xml文件中去。

          4.修改web.xml文件

          <servlet-mapping>?
          ????????<servlet-name>Connector</servlet-name>?
          ????????<url-pattern>/editor/filemanager/browser/default/connectors/jsp/connector</url-pattern>?
          ????</servlet-mapping>?

          ????<servlet-mapping>?
          ????????<servlet-name>SimpleUploader</servlet-name>?
          ????????<url-pattern>/editor/filemanager/upload/simpleuploader</url-pattern>??
          ?</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>

          這里的/FCKeditor/是對(duì)應(yīng)你webroot目錄下的FCKeditor目錄。

          5.拷貝FCKeditor-2.3\web\WEB-INF\lib下的兩個(gè)jar包到WebRoot\WEB-INF\lib目錄下
          (在項(xiàng)目的庫(kù)中添加FCKeditor-2.3\web\WEB-INF\lib下的兩個(gè)jar包? 達(dá)不到同樣的效果,一定要拷貝到lib目錄下)

          6.在webroot目錄下新建一個(gè)jsp,使用默認(rèn)的MyJsp.jsp即可。

          7. 文件開頭處加入? :
          <%@ taglib uri="
          8.在jsp中嵌入的代碼:在Jsp中使用
          方法一:(可能會(huì)出現(xiàn):The requested resource (/FCK/editor/fckeditor.html) is not available)
          <c:set var="basepath"><c:url value="/fck/" /></c:set>
          <FCK:editor id="descn" basePath="${basepath}" height="500px">
          <c:out value="${book.descn}" escapeXml="false" default="" />
          </FCK:editor>

          方法二:
          <FCK:editor id="infoContent" basePath="/FCK/FCKeditor/"
          ????????????? width="800"
          ????????????? height="300"?????????????????????????
          ????????????? >
          ????????????? 請(qǐng)輸入內(nèi)容
          </FCK:editor>

          9.部署好工程,開啟tomcat,打開MyJsp.jsp頁(yè)面即可。




          10.三種方法調(diào)用FCKeditor
          <%--
          三種方法調(diào)用FCKeditor
          1.FCKeditor自定義標(biāo)簽 (必須加頭文件 <%@ taglib uri="/TestFCKeditor" prefix="FCK" %> )
          2.script腳本語(yǔ)言調(diào)用 (必須引用 腳本文件 <script type="text/javascript" src="/TestFCKeditor/FCKeditor/fckeditor.js"></script> )
          3.FCKeditor API 調(diào)用 (必須加頭文件 <%@ page language="java" import="com.fredck.FCKeditor.*" %> )
          --%>

          <%--
          <form action="show.jsp" method="post" target="_blank">
          <FCK:editor id="content" basePath="/TestFCKeditor/FCKeditor/"
          width="700"
          height="500"
          skinPath="/TestFCKeditor/FCKeditor/editor/skins/silver/"
          toolbarSet = "Default"
          >
          input
          </FCK:editor>
          <input type="submit" value="Submit">
          </form>
          --%>

          <form action="show.jsp" method="post" target="_blank">
          <table border="0" width="700"><tr><td>
          <textarea id="content" name="content" style="WIDTH: 100%; HEIGHT: 400px">input</textarea>
          <script type="text/javascript">
          var oFCKeditor = new FCKeditor('content') ;
          oFCKeditor.BasePath = "/TestFCKeditor/FCKeditor/" ;
          oFCKeditor.Height = 400;
          oFCKeditor.ToolbarSet = "Default" ;
          oFCKeditor.ReplaceTextarea();
          </script>
          <input type="submit" value="Submit">
          </td></tr></table>
          </form>

          <%--
          <form action="show.jsp" method="post" target="_blank">
          <%
          FCKeditor oFCKeditor ;
          oFCKeditor = new FCKeditor( request, "content" ) ;
          oFCKeditor.setBasePath( "/TestFCKeditor/FCKeditor/" ) ;
          oFCKeditor.setValue( "input" );
          out.println( oFCKeditor.create() ) ;
          %>
          <br>
          <input type="submit" value="Submit">
          </form>
          --%>

          添加文件/TestFCKeditor/show.jsp:
          <%
          String content = request.getParameter("content");
          out.print(content);
          out.println(request.getParameter("title"));
          %>
          <!--表單中的input的name可以等于這里request.getParameter("parameter") 中的parameter參數(shù)??梢酝ㄟ^out.println輸出
          <FCK:editor id="content".....>FCK中的id相當(dāng)于input的name
          -->



          11.FCKeditor編輯器文件上傳配置

          FCKeditor編輯器的配置文件是fckconfig.js,其中有對(duì)編輯器各種默認(rèn)屬性的設(shè)置。以下是fckeditor與java集成使用 時(shí)上傳文件的設(shè)置(需要注意的是編輯器不會(huì)自動(dòng)創(chuàng)建文件上傳的文件夾,需要在項(xiàng)目的根目錄中手動(dòng)添加),將fckeditor.js文件中以下幾個(gè)屬性原 來(lái)的值修改為如下設(shè)置:

          至此,即可使用FCKeditor的文件上傳功能。

          posted on 2006-11-10 12:42 小雨不打傘 閱讀(2230) 評(píng)論(2)  編輯  收藏 所屬分類: web學(xué)習(xí)心得

          評(píng)論

          # re: JSP下FCKeditor的安裝 2008-02-03 10:44 Rosekisser

          很好很實(shí)用!  回復(fù)  更多評(píng)論   

          # re: JSP下FCKeditor的安裝 2014-04-15 18:15 最代碼

          參考下這個(gè)代碼:jsp結(jié)合fckeditor使用的小demo分享http://www.zuidaima.com/share/1780911659551744.htm  回復(fù)  更多評(píng)論   

          公告

          點(diǎn)擊這里給我發(fā)消息 QQ:232720563


            MSN:new_haihua@hotmail.com

          導(dǎo)航

          統(tǒng)計(jì)

          常用鏈接

          留言簿(2)

          隨筆分類(51)

          最新隨筆

          積分與排名

          最新評(píng)論

          閱讀排行榜

          主站蜘蛛池模板: 大兴区| 横峰县| 鹰潭市| 乐昌市| 龙门县| 苍南县| 盐边县| 闻喜县| 特克斯县| 德钦县| 府谷县| 北海市| 东山县| 西乡县| 和林格尔县| 买车| 宣威市| 大同县| 政和县| 资溪县| 门源| 阜宁县| 武平县| 广河县| 陈巴尔虎旗| 通化市| 凤冈县| 拜泉县| 普洱| 凤凰县| 正镶白旗| 旬邑县| 辽宁省| 红桥区| 固镇县| 浦县| 武功县| 青龙| 宁安市| 蕉岭县| 文登市|