FCKeditor的JSP配置与使用

一 FCKeditor的下载

先给出FCKeditor的下载页面 http://ckeditor.com/download

下载FCKeditor_2.6.6.zip fckeditor-java-2.6-bin.zip fckeditor-java-demo-2.6.war 这3个文件

分别解压后备用

二 将FCKeditor放入Web Project

  1. 将fckeditor拷贝,放置在WebRoot下

    editor
    fckconfig.js
    fckeditor.js
    fckpackager.xml
    fckstyle.js
    fcktemplates.xml


    以上红色部分 为必要项,喜欢用javascript显示就需要用fckeditor.js

  2. 导入fckeditor所需要的相关jar包
    fckeditor-java-core-2.6.jar
    commons-fileupload.jaar
    commons-io.jar
    imageinfo.jar
    slf4j-api.jar
    slf4j.jar
  3. 在src目录下新建fckeditor.properties配置文件,内容如下

    connector.userActionImpl=net.fckeditor.requestcycle.impl.EnabledUserAction
  4. 在web.xml文件中配置servlet

三 FCKeditor在页面上的使用

  1. 在<head>中引入 <script type="text/javascript" src="fckeditor/fckeditor.js"></script>
  2. 在body中需要使用fckeditor的地方加入
    <script type="text/javascript">
    var oFCKeditor = new FCKeditor('FCKeditor1');
    oFCKeditor.BasePath="<%=request.getScheme()+ "://" +request.getServerName() + ":" +     request.getServerPort()  + request.getContextPath() + "/fckeditor/"%>";
    oFCKeditor.Create();
    </script>

四 FCKeditor配置

FCKeditor的相关配置文件都可以在fckconfig.js修改,也可以自定义文件修改.

 

本文中使用自定配置修改

 

在WebRoot下新建/js/myfckconfig.js文件,内容如下


 

更改页面

<SCRIPT type="text/javascript">
var oFCKeditor = new FCKeditor('content','100%','400px');
oFCKeditor.BasePath="<%=request.getScheme()+ "://" +request.getServerName() + ":" +     request.getServerPort()  + request.getContextPath() + "/fckeditor/"%>";

//指定自定义配置文件路径
oFCKeditor.Config["CustomConfigurationsPath"]="/FCK/js/myfckconfig.js";

//选择工具集
oFCKeditor.ToolbarSet="Custom";

oFCKeditor.Create();
</SCRIPT>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值