一、下载FCKeditor;
需要下载两个包:
1、FCKeditor_2.3.1.zip 地址:http://www.fckeditor.net/download/default.html
2、FCKeditor-2.3.zip (for java) 地址:http://sourceforge.net/project/showfiles.php?group_id=75348&package_id=129511,注意要下载2005-08-11的2.3版本
二、在Eclipse里面新建一个工程,然后把上面两个包的部分文件(对你有用的)考进工程相应目录,
1、解压缩FCKeditor-2.3.zip,在FCKeditor-2.3\web\WEB-INF\lib里面你会看到commons-fileupload.jar和FCKeditor-2.3.jar这两个jar包,考入你工程里面的\workspace\yjhmily\WebRoot\WEB-INF\lib(yjhmily是我的工程名)中,其中commons-fileupload.jar已经存在,覆盖就行了!
2、解压缩FCKeditor_2.3.1.zip,在\FCKeditor_2.3.1\FCKeditor中你会看到一个editor文件夹,这里面放的是一些必须的HTML、JS、skin、images、css……等文件,将整个文件夹考入你工程里面的\workspace\yjhmily\WebRoot\FCKeditor\editor中,其中FCKeditor是我自己建的目录,便与标识。当然,你也可以直接把editor文件夹考到WebRoot目录下。
3、将\FCKeditor_2.3.1\FCKeditor中的fckconfig.js、fckeditor.afp、fckeditor.cfc、fckeditor.cfm、fckeditor.js、fckeditor.lasso、fckstyles.xml、fcktemplates.xml全部考入\workspace\yjhmily\WebRoot\FCKeditor下。其实只要保证这些文件跟editor在同一目录下就可以了!
三、我的工程结构图:
fck.jpg
4、修改FCKeditor/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.FlashUploadURL = FCKConfig.BasePath + 'filemanager/upload/simpleuploader?Type=Flash' ;
FCKConfig.ImageUploadURL = FCKConfig.BasePath + 'filemanager/upload/simpleuploader?Type=Image' ;
5、修改web.xml文件,添加以下内容
<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>true</param-value>
</init-param>
<init-param>
<param-name>AllowedExtensionsFile</param-name>
<param-value></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>DeniedExtensionsImage</param-name>
<param-value></param-value>
</init-param>
<init-param>
<param-name>AllowedExtensionsFlash</param-name>
<param-value>swf|fla</param-value>
</init-param>
<init-param>
<param-name>DeniedExtensionsFlash</param-name>
<param-value></param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<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>false</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-mapping>
<servlet-mapping>
<servlet-name>SimpleUploader</servlet-name>
<url-pattern>/FCKeditor/editor/filemanager/upload/simpleuploader</url-pattern>
</servlet-mapping>
<servlet-mapping>
6、jsp调用FCKeditor的几种方式:
a. 使用FCKeditor自定义标签
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ taglib uri="/WEB-INF/FCKeditor.tld " prefix="fck"%>
<html>
<head>
<title>Test</title>
</head>
<body>
<!-- 标签调用方式 -->
<FORM action="show.jsp">
<fck:editor id="content" basePath="/test/fckeditor/" height="400"
width="800" skinPath="/test/fckeditor/editor/skins/default/"
toolbarSet="Default"
imageBrowserURL="/test/fckeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector"
linkBrowserURL="/test/fckeditor/editor/filemanager/browser/default/browser.html?Connector=connectors/jsp/connector"
flashBrowserURL="/test/fckeditor/editor/filemanager/browser/default/browser.html?Type=Flash&Connector=connectors/jsp/connector"
imageUploadURL="/test/fckeditor/editor/filemanager/upload/simpleuploader?Type=Image"
linkUploadURL="/test/fckeditor/editor/filemanager/upload/simpleuploader?Type=File"
flashUploadURL="/test/fckeditor/editor/filemanager/upload/simpleuploader?Type=Flash">
</fck:editor>
<input type="submit" value="提交">
</FORM>
</body>
</html>
b. 用Javascript脚本语言调用
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<html>
<head>
<title>Test</title>
<script type="text/javascript" src="/test/fckeditor/fckeditor.js"></script>
</head>
<body>
<form action="show.jsp" method="get">
<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 = "/test/fckeditor/" ;
oFCKeditor.Height = 400;
oFCKeditor.ToolbarSet = "Default" ;
oFCKeditor.ReplaceTextarea();
</script>
<input type="submit" value="Submit">
</td>
</tr>
</table>
</form>
</body>
</html>
c. FCKeditor API 调用
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ page language="java" import="com.fredck.FCKeditor.*" %>
<html>
<head>
<title>Test</title>
</head>
<body>
<form action="show.jsp" method="post">
<%
FCKeditor oFCKeditor ;
oFCKeditor = new FCKeditor( request, "content" ) ;
oFCKeditor.setBasePath( "/test/fckeditor/" ) ;
oFCKeditor.setValue( "input" );
oFCKeditor.setWidth("800");
out.println(oFCKeditor.create()) ;
%>
<br>
<input type="submit" value="Submit">
</form>
</body>
</html>
测试页面:show.jsp
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP 'test.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<%=new String(request.getParameter("content").getBytes("iso-8859-1"),"UTF-8")%>
</body>
</html>
分享到:
相关推荐
在Java中,通常使用Servlet来接收和处理FCKEditor提交的数据。FCKEditor会将内容封装在POST请求的`fckeditor`字段中,服务器端可以通过HttpServletRequest对象获取到这个字段的值。以下是一个简单的示例: ```java ...
"Fckeditor在Java中的运用"主要涉及的是如何在Java Web开发环境中集成并使用FCKeditor,一个流行的开源在线富文本编辑器。FCKeditor允许用户在Web页面上进行类似Word的文本编辑,支持丰富的格式设置,图片上传等功能...
FCKeditor.java是一个配套库,专为在Java环境中使用FCKeditor而设计,由Simone Chiaretta开发。你可以从官方站点获取FCKeditor.java的2.3.2版本。 以下是将FCKeditor集成到Java Web项目的基本步骤: 1. 创建一个新...
接着,将fck-faces-1.7.26.jar添加到类路径,以便于在Java环境中使用FCKeditor的功能。然后,在JSF页面中定义fck-faces组件,配置相应的属性,如宽度、高度、初始化时的HTML内容等。最后,通过后台处理编辑器提交的...
"使用详解"部分,如"FCKEditor使用详解_2003.doc"文档,很可能是对如何在Java应用中集成和使用FCKeditor的详细教程。这份文档可能涵盖了以下内容: 1. **安装与配置**:介绍如何下载并引入FCKeditor到Java项目中,...
2. `samples`:示例代码和页面,帮助开发者理解如何在实际项目中使用FCKeditor。 3. `skins`:编辑器皮肤文件,用于改变编辑器的外观。 4. `lang`:包含不同语言的翻译文件,用于实现多语言支持。 5. `plugins`:...
在Java中,可以使用`request.getParameter("editor")`获取编辑器内的HTML内容,然后存储到数据库或其他持久化介质中。 6. **处理上传**:FCKeditor的Servlet会处理上传的文件和图片。你需要根据实际需求配置上传...
在Java Web项目中使用FCKeditor,需要依赖FCKeditor.java库。配置步骤如下: 1. 创建一个名为FCKTest的Web应用程序项目。 2. 将解压后的FCKeditor文件夹放置在项目根目录下。 3. 从FCKeditor-2.3.zip压缩包中提取`...
### FCKeditor编辑器在Java中的使用与配置详解 #### 引言 FCKeditor是一款功能强大且易于使用的网页编辑器,它支持多种编程语言,包括Java。在Java环境中使用FCKeditor,不仅可以提高文本编辑的灵活性,还能增强...
### 在Java Web应用中集成FCKeditor 1. **下载与引入**: 首先,你需要从官方网站或者通过`lib`目录下的文件下载FCKeditor的Java版本。将包含的jar文件(例如fckeditor.jar)添加到项目的类路径中。 2. **配置**: ...
二、FCKeditor在Java中的配置 1. 引入库:首先,你需要将FCKeditor的JavaScript库和相关的CSS文件添加到你的Web项目的静态资源目录中,例如放在`/js`和`/css`目录下。 2. HTML集成:在需要使用FCKeditor的JSP页面中...
在FCKeditor+Java超炫相册中,FCKeditor主要用于用户上传和编辑相册中的图片描述,提供了一个直观、易用的界面。 其次,Java在该项目中扮演了服务器端的角色,负责处理用户的请求,如上传图片、检索图片列表、删除...
这个演示程序提供了如何在Java应用中集成FCKeditor的实例,开发者可以通过运行这个WAR文件来快速体验和学习如何在自己的项目中使用FCKeditor。 FCKeditor的特性包括: 1. **跨浏览器支持**:FCKeditor支持多种主流...
6. **API使用**:FCKeditor提供了一套详细的API,开发者可以通过调用这些API方法来控制编辑器的行为,如初始化编辑器、设置默认样式、禁用某些功能等。 7. **安全性**:在使用FCKeditor时,必须注意XSS(跨站脚本...
这些特性在2.4.1版本的FCKeditor-java中可能被使用,导致在JDK 1.4环境下编译失败或运行异常。 在着手修改源码前,我们需要对FCKeditor-java的源代码进行分析,找出使用了JDK 5及以上版本特性的部分。这通常包括...
这意味着你可以直接在JSP页面中使用它,通过简单的配置和标签就能将富文本编辑功能集成到你的Java Web应用中。 至于"www.pudn.com.txt",这可能是一个包含下载链接或者教程资源的文本文件,通常在这样的开源项目中...
FCKeditor.java-2.3.2 + FCKeditor_2.5.1 + 中文API 黄金搭档! 最近做项目需要jsp里使用编辑器,在网上搜资料 几乎前篇一律, 版本太多,一晚上没睡 调试通了!有兴趣的可以研究下!
在这个压缩包中,包含了FCKeditor与Java相关的资源,便于开发者集成到Java Web项目中。以下是这些资源的具体介绍: 1. **fckeditor-java-2.6-bin**: 这个文件夹包含了FCKeditor的Java版本二进制库,它提供了Java ...