FCKeditor在线编辑器

FCKeditor在线编辑器
FCKeditor 这个开源的HTML 文本编辑器可以让web 程序拥有如MS Word 这样强大的编辑功
FCKeditor官司方网址:http://www.fckeditor.net/

FCKeditor在线DEMO:http://www.fckeditor.net/demo

FCKeditor下载直址:http://www.fckeditor.net/download 最新版已经是2.6了。

在项目中使用FCKeditor在线编辑器:
(1) 新建一个WEB工程;
(2) 解压FCKeditor_2.6.zip包,将其中的editor文件夹复制到项目中去;
(3) 解压FCKeditor_2.6.zip包,将其中的fckconfig.js、fckeditor.js、fckstyles.xml、fcktemplates.xml赋值到项目中的WebRoot目录下面;
(4) 将FCKeditor.jar文件复制到WebRoot\WEB-INF\lib目录;
(5) 将FCKeditor.tld文件复制到WEB-INF下面;
(6) 修改web.xml配置文件中的信息,如下;
<!-- fckeditor start -->
<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>false</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>
<description>This is the description of my J2EE component</description>
<display-name>This is the display name of my J2EE component</display-name>
<servlet-name>PostArticle</servlet-name>
<servlet-class>servlet.PostArticle</servlet-class>
</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>
<servlet-name>PostArticle</servlet-name>
<url-pattern>/servlet/post</url-pattern>
</servlet-mapping>
<!-- fckeditor end -->


(7) 在JSP页面中使用,如:test.jsp
首先要在报头中加入
<%@ taglib uri="http://fckeditor.net/tags-fckeditor" prefix="f"%>
还要注意basepath及path的设置
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<body>
<form action="servlet/post" method="post">
title:<input type="text" name="title"><br>
<f:editor id="content" basePath='<%=path + "/FCKeditor/"%>'
imageBrowserURL='<%=path
+ "/FCKeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector"%>'
linkBrowserURL='<%=path
+ "/FCKeditor/editor/filemanager/browser/default/browser.html?Connector=connectors/jsp/connector"%>'
flashBrowserURL='<%=path
+ "/FCKeditor/editor/filemanager/browser/default/browser.html?Type=Flash&Connector=connectors/jsp/connector"%>'
imageUploadURL='<%=path
+ "/FCKeditor/editor/filemanager/upload/simpleuploader?Type=Image"%>'
linkUploadURL='<%=path
+ "/FCKeditor/editor/filemanager/upload/simpleuploader?Type=File"%>'
flashUploadURL='<%=path
+ "/FCKeditor/editor/filemanager/upload/simpleuploader?Type=Flash"%>'>


</f:editor>
<input type="submit">
</form>
</body>


后面的附件是实例。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值