日期:2014-05-16 浏览次数:20439 次
1. 下载fckeditor-java-demo-2.6.war和fckeditor-java-2.6-bin.tar.gz
??? 下载地址: http://sourceforge.net/projects/fckeditor/files/FCKeditor.Java/2.6/
?
2. 解压fckeditor-java-demo-2.6.war, 获取以下资源
???? 主目录下的: fckeditor文件夹
?
???? lib目录下的:
?????? commons-fileupload-1.2.1.jar
?????? commons-io-1.3.2.jar
?????? imageinfo-1.9.jar
?????? java-core-2.6.jar
?????? slf4j-api-1.5.8.jar
?????? slf4j-simple-1.5.8.jar
?
???? WEB-INF\classes目录下的:? ???
?????? fckeditor.properties
?
???? web.xml中的:
<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>?
?
3. 建立web项目sample
? 将fckeditor文件夹sample\WebContent\plugins\fckeditor
?
? 在lib中放入
?????? commons-fileupload-1.2.1.jar
?????? commons-io-1.3.2.jar
?????? imageinfo-1.9.jar
?????? java-core-2.6.jar
?????? slf4j-api-1.5.8.jar
?????? slf4j-simple-1.5.8.jar
?
? 在sample\src中放入(eclipse自动编译后会到classes目录下)
?????? fckeditor.properties
?
? 在web.xml中加入
<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>/plugins/fckeditor/editor/filemanager/connectors/*</url-pattern> </servlet-mapping>?
?
?
4. 调整配置
?
? fckeditor.properties
# allow client upload file to server connector.userActionImpl=net.fckeditor.requestcycle.impl.EnabledUserAction # user can see path connector.userFilesPath=/userfiles/fckeditor # user can store path connector.userFilesAbsolutePath=/userfiles/fckeditor # the default path of the editor fckeditor.basePath=/plugins/fckeditor
?
fckconfig.js
FCKConfig.AutoDetectLanguage = false ; FCKConfig.DefaultLanguage = 'zh-cn' ; // 可以加入自定义的工具栏 // custom your Toolbar and use it FCKConfig.ToolbarSets["Custom"] = [ ['Bold','Italic','-','OrderedList','UnorderedList','-','Link','Unlink'] ] ;?
5. 使用
? ? fckeditor.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib uri="http://java.fckeditor.net" prefix="FCK"%> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>use FCKeditor</title> </head> <body> <form action="commit.jsp" method="post" target="_blank"> <FCK:editor instanceName="EditorDefault" toolbarSet="Default" height="300" width="98%" > <jsp:attribute name="value"> This is some <strong>sample text</strong>. You are using <a href="http://www.fckeditor.net">FCKeditor</a>. </jsp:attribute> </FCK:editor> </body> </html>
?
?? commit.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <% String content = request.getParamet