FckEditor for java 2.4的JSP 配置方法详解

系统 1635 0
文章转自:http://hi.baidu.com/huqiwen/blog/item/7d36b15113fddd1e377abe7d.html
==============
由于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.1-bin.zip(发行版,如果需要源码或者demo包请另行下载)
请下载demo包,否则会出现留言中那位朋友的错误!
下载之后分别为:FCKeditor_2.6.3.zip 和 fckeditor-java-2.4.1-bin.zip(fckeditor-java-demo-2.4.1.war)将它们分别解压。

2、首先在MyEclipse(或者其他的IDE)下建立一个新项目例如:fckeditDemo即http://localhost:8080/fckeditDemo
现在将解压后的FCKeditor_2.6.3.zip 里面的fckeditor文件夹拷贝到当前的项目文件夹里面。
引入fckeditor的六个包:




我的fckeditor项目目录结构如下:


3、配置web.xml。配置文件如下,这就是全部了,其他的不需要再配置,由于SimpleUploaderServle整合到了ConnectorServlet里面,所以 文件上传 等都不需要再配置。
    
<servlet>
   <servlet-name>Connector</servlet-name>
   <servlet-class>
    net.fckeditor.connector.ConnectorServlet
   </servlet-class>
   <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
   <servlet-name>Connector</servlet-name>
   <url-pattern>
    /fckeditor/editor/filemanager/connectors/*
   </url-pattern>
</servlet-mapping>

  

4、在src目录下面建立fckeditor.properties资源文件,在里面写入这么一行connector.userActionImpl=net.fckeditor.requestcycle.impl.UserActionImpl

5、下面写测试页面:
    
<%@ 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>

  

显示数据的页面:
    
<%@ 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>

  


6、给FckEditor瘦身
      删除fckeditor目录下面所有以“_”开头的文件或者文件夹,像"_samples"、"_documentation.html“等
     删除fckeditor目录下面除了,fckconfig.js   fckpackage.xml fckstyles.xml   fcktemplates.xml外的所有文件,当然要保留editor文件夹
     删除fckeditor/editor/lang目录下面除了en.js、 zh-cn.js外的所有文件
     删除fckeditor\editor\filemanager目录下面的connectors文件夹
     删除editor\skins目录下面除了default下面的文件夹,这个里面是皮肤,共有三种,可以在fckconfig.js里面设置。
PS:有关中文乱码问题请参考:http://hi.baidu.com/huqiwen/blog/item/c709aa18fa187a0135fa4103.html

FckEditor for java 2.4的JSP 配置方法详解


更多文章、技术交流、商务合作、联系博主

微信扫码或搜索:z360901061

微信扫一扫加我为好友

QQ号联系: 360901061

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描下面二维码支持博主2元、5元、10元、20元等您想捐的金额吧,狠狠点击下面给点支持吧,站长非常感激您!手机微信长按不能支付解决办法:请将微信支付二维码保存到相册,切换到微信,然后点击微信右上角扫一扫功能,选择支付二维码完成支付。

【本文对您有帮助就好】

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描上面二维码支持博主2元、5元、10元、自定义金额等您想捐的金额吧,站长会非常 感谢您的哦!!!

发表我的评论
最新评论 总共0条评论