在JSP中使用FCKeditor__JSP

來源:互聯網
上載者:User
在JSP中使用 FCKeditor
1.1運行庫 commons-fileupload-1.1.jar FCKeditor-2.3.jar 1.2編輯器版本 FCKeditor 2.0 FCKeditor  是一套線上編輯器,它幾乎囊括了現在網上所有的線上編輯器的功能,功能的實現相當完善,同時可自由定製功能按鈕,支援多種語言環境下配置安裝

  1.3使用步驟 1.3.1 Web 應用程式目錄結構


1.3.2配置說明 <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
  <display-name>demo</display-name>
  <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>false</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</param-value>
    </init-param>
    <init-param>
      <param-name>AllowedExtensionsFlash</param-name><!—允許上傳Flash類型清單-->
      <param-value>swf|fla</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映射-->
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>SimpleUploader</servlet-name>
    <url-pattern>/FCKeditor/editor/filemanager/upload/simpleuploader</url-pattern>
  </servlet-mapping><!—用於上傳檔案的servlet映射-->
  <taglib>
    <taglib-uri>FCK</taglib-uri><!—標籤庫映射-->
    <taglib-location>/WEB-INF/classes/FCKeditor.tld</taglib-location>
  </taglib>
</web-app>
1.3.3 JSP 引用方式


1.3.4運行示範



1.3.5 JSP 原文 <%@page contentType="text/html; charset=GBK"%>
<%@taglib uri="FCK" prefix="FCK"%>
<html>
<head>
<title>index</title>
</head>
<body bgcolor="#ffffff">
<form action="postdata.jsp" name="form1" method="POST">
文檔標題:<input type="text" name="test" value="測試資料" />
<FCK:editor id="EditorDefault" basePath="/FCKeditor/"
                                fontNames="宋體;Arial;Courier New;Times New Roman;Verdana"
                            imageBrowserURL="/FCKeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector"
                            linkBrowserURL="/FCKeditor/editor/filemanager/browser/default/browser.html?Connector=connectors/jsp/connector"
                            flashBrowserURL="/FCKeditor/editor/filemanager/browser/default/browser.html?Type=Flash&Connector=connectors/jsp/connector"
                            imageUploadURL="/FCKeditor/editor/filemanager/upload/simpleuploader?Type=Image"
                            linkUploadURL="/FCKeditor/editor/filemanager/upload/simpleuploader?Type=File"
                            flashUploadURL="/FCKeditor/editor/filemanager/upload/simpleuploader?Type=Flash">
                            以下內容為 <strong>測試資料</strong>. 歡迎使用 <a href="http://www.fredck.com/fckeditor/">FCKeditor</a>.
</FCK:editor>
<input type="submit" value="提交"/>
</form>
</body>
</html>

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.