FCKEditor的使用

文档:
http://www.fckeditor.net/

http://docs.fckeditor.net/FCKeditor_2.x/Users_Guide

http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide

1.Download FCKeditor_2.6.3b.zip, copy FCKeditor directory to webapp/.
Delete some unused file:
(1)all folders whose name start with "_" under FCKeditor directory and its child directory.
(2)all files under FCKeditor directory except fckconfig.js, fckeditor.js, fckstyles.xml, fcktemplates.xml.
(3)some files under editor/skins,editor/lang etc if you will not use them.

2.Download FCKeditor-2.3.zip,This is the JSP Integration Pack for using FCKeditor inside a java server page without the complexity of using a Java scriptlets or the javascript api.

3.Copy these two servlet,servlet-mapping from FCKeditor-2.3/web/WEB-INF/web.xml to web.xml in your project,
and do some change.
change servlet-mapping from
<servlet-mapping>
<servlet-name>Connector</servlet-name>
<url-pattern>/editor/filemanager/browser/default/connectors/jsp/connector</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>SimpleUploader</servlet-name>
<url-pattern>/editor/filemanager/upload/simpleuploader</url-pattern>
</servlet-mapping>
to
<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>

4.Copy all libs under FCKeditor-2.3/web/WEB-INF/lib to /WEB-INF/lib of your project.

5.Copy xalan.jar to project if you want to browse and upload image etc.

6. Add a jsp.
<%
//It is mandatory. or
String content = (String)request.getAttribute("content");
if (content != null) {
//content = content.replaceAll("\r\n", "");
content = content.replaceAll("\r", "");
content = content.replaceAll("\n", "");
content = content.replaceAll("\"", "'");
} else {
content = "";
}
%>
<script type="text/javascript">

//传入参数为表单元素(由FCKeditor生成的input或textarea)的name
var oFCKeditor = new FCKeditor('content');

//指定FCKeditor根路径,也就是fckeditor.js所在的路径
oFCKeditor.BasePath='<session:constant name="ContextPath"/>/fckeditor/';

//The path of EditorAreaCSS should be passed from the server side.
oFCKeditor.Config['EditorAreaCSS'] = '<session:constant name="ContextPath"/>/css/test.css';

oFCKeditor.Height='100%';
oFCKeditor.ToolbarSet='Default';
oFCKeditor.Value="<%=content%>";//默认值
oFCKeditor.Create();
</script>


7. fckconfig.js
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.ImageUploadURL = FCKConfig.BasePath + 'filemanager/upload/simpleuploader?Type=Image';
FCKConfig.FlashUploadURL = FCKConfig.BasePath + 'filemanager/upload/simpleuploader?Type=Flash';

[color=blue]8. Add a watermark picture in the edit textare.[/color]
body
{
background-image: url(your image path);
background-repeat: no-repeat;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值