由于FckEditor for java 2.4相对于2.3而言做了许多改变,这些改变使得我们的Fckeditor配置起来更方便。例如:
基础包名从:com.fredck.FCKeditor 改为net.fckeditor.
文件上传SimpleUploaderServle整合到了ConnectorServlet里面,WEB,XML的配置就简单多了,下面通过一个实例说明配置详细步骤
1、首先登陆www.fckeditor.net/download下载FCKeditor的最新版本,需要下载2个压缩包,一个是基本应用。另一个是在为在jsp下所准备的配置。
最新版本为:FckEditor2.6.3和FckEditor for java 2.4
FCKeditor 2.6.3下载地址:sourceforge.net/project/downloading.php
具体下载地址:http://easynews.dl.sourceforge.net/sourceforge/fckeditor/FCKeditor_2.6.3.zip
FCKeditor for Java 下载地址:sourceforge.net/project/downloading.php
具体下载地址:http://switch.dl.sourceforge.net/sourceforge/fckeditor/fckeditor-java-2.4-bin.zip 下载之后分别为:FCKeditor_2.6.3.zip 和 fckeditor-java-2.4-bin.zip
(fckeditor-java-demo-2.4.war)将它们分别解压。
下载slf4j-1.5.2.zip 地址 :http://slf4j.org/dist/slf4j-1.5.2.zip
2.安装:
1)解压FCKeditor_2.6.3b.zip,将解压的到的fckeditor整个文件夹完整复制到工程目录WebRoot下。
2)解压fckeditor-java-2.4-bin.zip,在fckeditor-java-2.4-bin的解压缩文件中提取出4个JAR包,分别为fckeditor-java-core-2.4.jar、commons-fileupload-1.2.1.jar、 commons-io-1.3.2.jar、slf4j-api-1.5.2.jar,
3)解压slf4j-1.5.2.zip,提取slf4j-api-1.5.2.jar和slf4j-simple-1.5.2.jar
4)将2、3步提取的5个包都都导如工程目录WEB-INF/bin中
3、在MyEclipse(或者其他的IDE)下建立一个新项目例如:FckedtiorTest 即http://localhost:8080/FckeditorTest
现在将解压后的FCKeditor_2.6.3.zip 里面的fckeditor文件夹拷贝到当前的项目文件夹里面。我的demo项目目录结构如下:
4、配置web.xml。配置文件如下,这就是全部了,其他的不需要再配置,由于SimpleUploaderServle整合到了ConnectorServlet里面,所以文件上传等都不需要再配置。
<servlet> <servlet-mapping> |
5、在src目录下面建立fckeditor.properties资源文件,在里面写入这么一行“connector.userActionImpl=net.fckeditor.requestcycle.impl.UserActionImpl”
6、下面写测试页面:
index.jsp
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%@ taglib uri="http://java.fckeditor.net" prefix="FCK" %> <html> <head> <title>FckEditor测试</title> </head> <body style="text-align: center;"> <div style="text-align: center;width: 600pt"> <h2>FckEditor测试</h2> <hr> <form action="ShowData.jsp" method="post"> <FCK:editor instanceName="test" height="400pt"> <jsp:attribute name="value"> 这里是<a href="http://hi.baidu.com/huqiwen">数据测试</a> </jsp:attribute> </FCK:editor> <input type="submit" value="提交"/> <input type="reset" value="重置"/> </form> </div> </body> </html> |
显示数据的页面:ShowData.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <head> <title>FCKeditor - 显示数据</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <% request.setCharacterEncoding("UTF-8"); String data = request.getParameter("test"); %> <body> <h1>FCKeditor - 显示数据</h1> <hr/><br /> <%=data%> </body> </html> |