FCKeditor是sourceforge.net上面的一个开源项目,主要是实现在线网页编辑器的功能,可以让web程序拥有如MS Word这样强大的编辑功能。官方网站为http://www.fckeditor.net ,在服务器端支持ASP.Net、ASP、ClodFusion、PHP、Java等语言,并且支持IE 5+、Mozilla 、Netscape等主流浏览器。
首先在官方网站
下载fckeditor,注意有两个包,一个是主文件,一个是
JSP整合包的。
1、解压FCKeditor_2.2.zip,(FCKeditor主文件),将FCKeditor目录复制到网站根目录下,
2、解压FCKeditor-2.3.zip,(jsp,FCKeditor整合包),作用: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、将FCKeditor-2.3/web/WEB-INF/web.xml中的两个servlet,servlet-mapping定义复制到自已项目的web.xml文件中
修改:
<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>
为:
<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、将FCKeditor-2.3/web/WEB-INF/lib目录下文件复制到自已项目的lib文件夹中
5、在需使用FCKeditor的jsp界面中加入:
// 文件开头处加入
<%@ taglib uri=\"http://fckeditor.net/tags-fckeditor\" prefix=\"FCK\" %>
//要使用的地方加入
<FCK:editor id=\"content\" basePath=\"/FCKeditor/\"
imageBrowserURL=\"/FCKeditor/editor/filemanager/browser/default/browser.html?
Type=Image&Connector=connectors/jsp/connector\"
linkBrowserURL=\"/FCKeditor/editor/filemanager/browser/default/browser.html?
Connector=connectors/jsp/connector\"
flashBrowserURL=\"/FCKeditor/editor/filemanager/browser/default/browser.html?
Type=Flash&Connector=connectors/jsp/connector\"
imageUploadURL=\"/FCKeditor/editor/filemanager/upload/simpleuploader?Type=Image\"
linkUploadURL=\"/FCKeditor/editor/filemanager/upload/simpleuploader?Type=File\"
flashUploadURL=\"/FCKeditor/editor/filemanager/upload/simpleuploader?Type=Flash\"> [Page]
this is default content :)
</FCK:editor>
启动服务器测试。。。。成功后,来给FCKeditor瘦瘦身.
1、将FCKeditor目