今天成功的在Struts2中整合了FCKeditor。
步骤如下:
1.到http://sourceforge.net/projects/fckeditor/files/FCKeditor.Java/2.6/下载对应的资源。我觉得还是先看看它的主页http://ckeditor.com/,顺便鉴赏一下FCKeditor的品味嘛。到了下载页面,只要是做程序的都知道要下载哪些资源。我自认为是做程序的,下载了这两个:fckeditor-java-2.6-bin.zip ,fckeditor-java-demo-2.6.war 。
2.在classpath里添加fckeditor.properties文件
connector.userActionImpl=net.fckeditor.requestcycle.impl.EnabledUserAction
3.把包导入到lib下面。个人觉得这是出问题的一个大方面,做Java的免不了包冲突,这是好处也是坏处。把下载到的lib包导入到项目时一定要注意是否有名字差不多的,我的基本上是把版本低的删除。
4.配置web.xml。关于这个,网上的文章太多了。我的基本上是这样。要看到那个提示,它不要你换行哦!
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>ConnectorServlet</servlet-name>
<servlet-class>
net.fckeditor.connector.ConnectorServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>ConnectorServlet</servlet-name>
<!-- Do not wrap this line otherwise Glassfish will fail to load this file -->
<url-pattern>/fckeditor/editor/filemanager/connectors/*</url-pattern>
</servlet-mapping>
5.把fckeditor-java-demo-2.6.war里面的那些个文件(fckeditor)拷到web项目下,这些比较精简。
6.基本可以了,在jsp页面就可以这样用了哦!
<%@ taglib prefix="fck" uri="http://java.fckeditor.net" %>
<fck:editor instanceName="downloadExplain" height="350" width="550" ></fck:editor>
7.我刚开始在用的时候装进去就可以,拿出来就不知道了,现在顺便把拿出来的也写一下,网上好像有其他,顺便写一下。
a.
<fck:editor instanceName="introduction" height="500" width="550" value="${product.introduction}"></fck:editor>
b.
<fck:editor instanceName="EditorDefault">
<jsp:attribute name="value">
这里显示文本区的内容,可以用struts2的标签,但是需要添加上escape属性
</jsp:attribute>
这里还可以配置其他参数,具体参见文档
</fck:editor>
c.
<%
FCKeditor fckEditor = new FCKeditor(request, "EditorDefault");
%>
<%
fckEditor.setInstanceName("strAnswer") ;
fckEditor.setValue("要显示的内容");
out.println(fckEditor);
%>
8.顺便说一下,那些个还在找图片为什么不能上传的人啊,检查一下包有没有冲突,基本上是包的问题了。
分享到:
相关推荐
fckeditor2.6JAR,fckeditor2.6所需的jar
FCKeditor2.6.4.1 在线编辑器 JSP 还有JSP上传文件组件
配置好的fckeditor2.6 lite3,请看bbs文件,直接可以使用
FCKeditor 2.6 浏览服务器 图片预览 FCKeditor 2.6 浏览服务器 图片预览 FCKeditor 2.6 浏览服务器 图片预览 FCKeditor 2.6 浏览服务器 图片预览 FCKeditor 2.6 浏览服务器 图片预览
FCKEditor2.6使用小示例FCKEditor2.6使用小示例FCKEditor2.6使用小示例FCKEditor2.6使用小示例
Struts2与FCKeditor的整合.doc
前段时间遇到fck最新版在asp中使用问题,现将配置过文件上传,由于时间仓促,做了简单精简,内附说明文件
本项目是根据itcast 和网上找的一些资料,自己写出来的一个fckeditor 项目,希望对大家有用,内含我所用到的所有文件,包括 FCKeditor_2.6.6.tar.gz 、fckeditor-java-2.4-bin.zip、fckeditor-java-2.4-src.zip、slf...
jsp 程序调用fckeditor2.6 版本的 小例子 本人发现fckeditor2.6加 fckeditor for 2.3 的时候在上传中文文件的时候会出现乱码 所以本人就小改了一下 fckeditor2.3的源代码,以时间重命名上传文件名,没什么技术...
该版本基于 FCKeditor 2.6 修改,旨在提高加载速度,删除不常用的功能,达到精简和优化的目的。 本次修改是基于源代码精简和优化再重新编译,保证功能正常的情况下,确保不残留任何垃圾、无用的代码。通过修改内容...
FCKeditor_2.6.4.1.tar.gz,最好的html在线编辑工具,同时可以进行文件上传,适合php,asp,java
该版本基于 FCKeditor 2.6 修改,旨在提高加载速度,删除不常用的功能,达到精简和优化的目的。 本次修改是基于源代码精简和优化再重新编译,保证功能正常的情况下,确保不残留任何垃圾、无用的代码。通过修改内容...
FCKEDITOR 2.6 配置手册 不错的资料,推荐给大家。。。。。。。。。。。。
fckEditor2.6美化实用版 修正了一些错误!共享给网友
最新的fckeditor 2.6jsp版,完整安装包,解压后直接放在网站根目录下就能用了,各项已经配置好了。绝对OK
FCKEditor2.6使用小示例完全示例
NULL 博文链接:https://william-k.iteye.com/blog/777938
NULL 博文链接:https://liubin2010.iteye.com/blog/1095687
fckeditor2.6_zengli.chm
FCKeditor2.6 上传图片报错解决方案 用FCKeditor上传图片时出现XML request error:OK(200)错误。终结解决方案。 替换fckeditor\editor\filemanager\browser\default\js下面的fckxml.js