1.1 运行库
FCKeditor 是一套在线编辑器,它几乎囊括了现在网上所有的在线编辑器的功能,功能的实现相当完善,同时可自由定制功能按钮,支持多种语言环境下配置安装
1.3 使用步骤
1.3.1 Web 应用目录结构
1.3.2
Web.xml
配置说明
<?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/upload1/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/upload1/simpleuploader?Type=Image"
linkUploadURL="/FCKeditor/editor/filemanager/upload1/simpleuploader?Type=File"
flashUploadURL="/FCKeditor/editor/filemanager/upload1/simpleuploader?Type=Flash">
以下内容为 <strong> 测试数据 </strong>. 欢迎使用 <a href="http://www.fredck.com/fckeditor/">FCKeditor</a>.
</FCK:editor>
<input type="submit" value=" 提交 "/>
</form>
</body>
</html>