在线编辑器对于我们作新闻产品之类的程序是很重要的,在网上找录了好了好一段时间,发现
FCKeditor,
跨平台的,正在进行的
jsp
项目正需要这款
html
在线编辑器。试用了一下
FCKeditor,
根据网上的文章小结一下:
1.
下载
FCKeditor.java 2.3 (FCKeditot
for java)
FCKeditor 2.2 (FCKeditor
基本文件
)
以下是下载地址:
http://www.fckeditor.net/download/default.html
2.
建立项目
:
建立项目
tomcat/webapps/TestFCKeditor.
3.
将
FCKeditor2.2
解压缩
将
FCKeditor2.2
解压缩
,
将整个目录
FCKeditor
复制到项目的根目录下,
目录结构为:
tomcat/webapps/TestFCKeditor/FCKeditor
然后将
FCKeditor-2.3.zip
(
java
)压缩包中
webWEB-INFlib
目录下的两个
jar
文件拷到项目的
WEB-INFlib
目录下。把其中的
src
目录下的
FCKeditor.tld
文件
copy
到
TestFCKedit/WEB-INF/
下
4.
合并
web.xml:
将
FCKeditor-2.3.zip
压缩包中
webWEB-INF
目录下的
web.xml
文件合并到项目的
WEB-INF
目录下的
web.xml
文件中。
5.
修改合并后的
web.xml
文件
修改合并后的
web.xml
文件,将名为
SimpleUploader
的
Servlet
的
enabled
参数值改为
true
,
以允许上传功能,
Connector Servlet
的
baseDir
参数值用于设置上传文件存放的位置。
添加标签定义
:
<taglib>
<taglib-uri>/TestFCKeditor</taglib-uri>
<taglib-location>/WEB-INF/FCKeditor.tld</taglib-location>
</taglib>
运行图:
6. 映射:
上面文件中两个servlet的映射分别为:/editor/filemanager/browser/default/connectors/jsp/connector
和/editor/filemanager/upload/simpleuploader,需要在两个映射前面加上/FCKeditor,
即改为/FCKeditor/editor/filemanager/browser/default/connectors/jsp/connector和
/FCKeditor/editor/filemanager/upload/simpleuploader。
7.修改skin文件夹
进入skin文件夹,如果你想使用fckeditor默认的这种奶黄色,
那就把除了default文件夹外的另两个文件夹直接删除.
8.删除无用文件
删除/FCKeditor/目录下除fckconfig.js, fckeditor.js, fckstyles.xml,
fcktemplates.xml四个文件以外的所有文件
删除目录/editor/_source,
删除/editor/filemanager/browser/default/connectors/下的所有文件
删除/editor/filemanager/upload/下的所有文件
删除/editor/lang/下的除了fcklanguagemanager.js, en.js, zh.js,
zh-cn.js四个文件的所有文件
9.修改配置:
打开/FCKeditor/fckconfig.js
修改 FCKConfig.DefaultLanguage = 'zh-cn' ;
把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' ;
10.其它
fckconfig.js总配置文件,可用记录本打开,修改后将文件存为utf-8 编码格式。找到:
FCKConfig.TabSpaces = 0 ; 改为FCKConfig.TabSpaces = 1 ;
即在编辑器域内可以使用Tab键。
如果你的编辑器还用在网站前台的话,比如说用于留言本或是日记回复时,那就不得不考虑安全了,
在前台千万不要使用Default的toolbar,要么自定义一下功能,要么就用系统已经定义好的Basic,
也就是基本的toolbar,找到:
FCKConfig.ToolbarSets["Basic"] = [
['Bold','Italic','-','OrderedList','UnorderedList','-','Unlink','-','Style','FontSize','TextColor','BGColor','-',
'Smiley','SpecialChar','Replace','Preview'] ] ;
这是改过的Basic,把图像功能去掉,把添加链接功能去掉,因为图像和链接和flash和图像按钮添加功能都能让前台
页直接访问和上传文件, fckeditor还支持编辑域内的鼠标右键功能。
FCKConfig.ContextMenu =
['Generic','Anchor','Flash','Select','Textarea','Checkbox','Radio','TextField','HiddenField',
'Button','BulletedList','NumberedList','TableCell','Table','Form']
;
这也是改过的把鼠标右键的“链接、图像,FLASH,图像按钮”功能都去掉。
找到: FCKConfig.FontNames = 'Arial;Comic Sans MS;Courier
New;Tahoma;Times New Roman;Verdana' ;
加上几种我们常用的字体
FCKConfig.FontNames
= '宋体;黑体;隶书;楷体_GB2312;Arial;Comic Sans MS;Courier New;Tahoma;Times
New Roman;Verdana' ;
11.添加文件
添加文件 /TestFCKeditor/test.jsp:
<%@ page language="java"
import="com.fredck.FCKeditor.*" %>
<%@ taglib uri="/TestFCKeditor" prefix="FCK"
%>
<script type="text/javascript"
src="/TestFCKeditor/FCKeditor/fckeditor.js"></script>
<%--
三种方法调用FCKeditor
1.FCKeditor自定义标签 (必须加头文件 <%@ taglib
uri="/TestFCKeditor" prefix="FCK" %> )
2.script脚本语言调用 (必须引用 脚本文件 <script
type="text/javascript"
src="/TestFCKeditor/FCKeditor/fckeditor.js"></script>
)
3.FCKeditor API 调用 (必须加头文件 <%@ page language="java"
import="com.fredck.FCKeditor.*" %> )
--%>
<%--
<form action="show.jsp" method="post"
target="_blank">
<FCK:editor id="content"
basePath="/TestFCKeditor/FCKeditor/"
width="700"
height="500"
skinPath="/TestFCKeditor/FCKeditor/editor/skins/silver/"
toolbarSet = "Default"
>
input
</FCK:editor>
<input type="submit"
value="Submit">
</form>
--%>
<form action="show.jsp" method="post"
target="_blank">
<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 = "/TestFCKeditor/FCKeditor/" ;
oFCKeditor.Height = 400;
oFCKeditor.ToolbarSet = "Default" ;
oFCKeditor.ReplaceTextarea();
</script>
<input type="submit"
value="Submit">
</td></tr></table>
</form>
<%--
<form action="show.jsp" method="post"
target="_blank">
<%
FCKeditor oFCKeditor ;
oFCKeditor = new FCKeditor( request, "content" ) ;
oFCKeditor.setBasePath( "/TestFCKeditor/FCKeditor/" ) ;
oFCKeditor.setValue( "input" );
out.println( oFCKeditor.create() ) ;
%>
<br>
<input type="submit"
value="Submit">
</form>
--%>
添加文件/TestFCKeditor/show.jsp:
<%
String content = request.getParameter("content");
out.print(content);
%>
12.测试
浏览http://localhost:8080/TestFCKeditor/test.jsp
ok!
相关推荐
FCKeditor (jsp在线编辑器)配置总结
JSP例子:Fckeditor整合web EQ 公式编辑器
三个压缩文件是我自己下载的,配置资料是网上的。 FCKeditor_2.6.5.zip fckeditor-java-2.6-bin.zip fckeditor-java-demo-2[1].6.war.zip 至于源码包,是用不上的
这是我在几天查找资料来做的。。。在我的测试当中算是没有问题。但不知道用在项目中会出现什么情况。。希望大家只是作为学习
这个是一个我修改过的fckeditor for jsp 的jar包的源代码,是fckeditor-2.3的,我修改了ConnectorServlet.java和SimpleUploaderServlet.java两个文件 我在这两个文件中都是加了一个静态变量encoding,private static...
FCKeditor2.6.4.1 在线编辑器 JSP 还有JSP上传文件组件
绝对好用的富文本编辑框 fckeditor 现在已经可以兼容java了 以后会兼容sturts 希望大家多多支持,多多研究 绝对能用 里面的JAR包 slf4j-api-1.5.2.jar slf4j-simple-1.5.2.jar fckeditor-java-core-2.4.jar ...
jsp结合html编辑器FCKeditor对Oracle CLOB大字段操作范例。
fckeditor commons-fileupload.jar FCKeditor-2.3.jar FCKeditor.tld web.xml struts2不兼容解决.txt
NULL 博文链接:https://wangdingxin.iteye.com/blog/2313262
FCKeditor_2.6.3.zip:编辑器的基本文件 fckeditor-java-2.4-bin.zip:用于集成jsp所需的jar类,5个 fckeditor-java-2.4-src.zip:开源的源码文件 fckeditor-java-demo-2.4.war:用于部署的一个例子 FckEditor for ...
对fckeditor和kindeditor进行实例化,修改后可以将它们加入到自己的项目中去
这是一套经过改良的专用于JSP的fckeditor,对应于fckeditor-2.4版本,fckeditor是一款有名的功能强大的网页在线编辑器,通过这款编辑器你可以对文字进行排版、插入上传图片、插入附件和链接等常用的图文处理功能,...
FCKeditor2.3 for jsp编辑器(内附配置说明)
jsp程序中使用fckeditor编辑器
非常好的FCKeditor Jsp 文本编辑器!! 经过本人修改和配制,功能已全部实现!!! 非常好的jsp文本编辑器,带示例
fckeditor 在线编辑器,有需要的jar包,已对上传中文图片,文档的类进行了修改。 jsp要引用fck标签,文档中忘记写了 <%@ taglib uri="http://java.fckeditor.net" prefix="FCK" %> 在src 文件夹下建一个文件...
FCKeditor 这个开源的HTML 文本编辑器可以让web 程序拥有如MS Word 这样强大的编辑功能,.FCKeditor 支持当前流行的浏览器。
FCKeditor编辑器是一个功能非常强大的Web编辑器,此例子是把它用在jsp上使用的,经测试可以使用....
根据配置文件,配置好,已经解决了上传中文图片无法显示的bug