配置FCKeditor_2.6.3+fckeditor-java-2.42008-08-08 16:18下载
http://www.fckeditor.net/download
FCKeditor.Java
http://sourceforge.net/project/showfiles.php?group_id=75348&package_id=129511
-1-
copy fckeditor文件夹到项目的webRoot目录下
-2-
添加Jar包
slf4j-simple-1.5.0.jar
slf4j-api-1.5.0.jar
java-core-2.4-beta-1.jar
commons-io-1.3.2.jar
commons-fileupload-1.2.jar
-3-
classes下
fckeditor.properties
内容:
connector.userActionImpl=net.fckeditor.requestcycle.impl.UserActionImpl
connector.userFilesPath=/UserUploadFile
###此处不写入资源文件则默认放在userFilesPath目录下###
#connector.resourceType.file.path
#connector.resourceType.image.path
#connector.resourceType.flash.path
#connector.resourceType.media.path
###########################################
connector.resourceType.file.extensions.allowed=|jpg|gif|png|rar|zip|txt|doc|wma|wmv|mp3|flv|swf|
connector.resourceType.file.extensions.denied=|com|exe|jsp|html|htm|shtml|bat|
connector.resourceType.media.extensions.allowed=|wma|wmv|mp3|flv|swf|
connector.resourceType.media.extensions.denied=|com|exe|jsp|html|htm|shtml|bat|
connector.resourceType.image.extensions.allowed=|jpg|png|gif|
connector.resourceType.image.extensions.denied=|com|exe|jsp|html|htm|shtml|bat|
connector.resourceType.flash.extensions.allowed=|swf|
connector.resourceType.flash.extensions.denied=|com|exe|jsp|html|htm|shtml|bat|
log4j.properties
内容:
log4j.rootLogger=DEBUG, SOCKET
log4j.appender.SOCKET=org.apache.log4j.net.SocketAppender
log4j.appender.SOCKET.RemoteHost=localhost
log4j.appender.SOCKET.Port=4445
log4j.logger.org.apache=WARN
-4-
项目的web.xml
<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>
-5-
页面中使用
<%@ taglib uri="http://java.fckeditor.net" prefix="FCK" %>
<form action="" method="post">
<FCK:editor instanceName="Default" value=" ">
</FCK:editor>
<br />
<input type="submit" value="Submit" />
</form>
1.上面 <FCK:editor instanceName="Default" value=" ">
</FCK:editor>中value值必须有空格!
否则就会有异常:
org.apache.jasper.JasperException: java.lang.NullPointerException
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
java.lang.NullPointerException
net.fckeditor.FCKeditor.createHtml(FCKeditor.java:238)
net.fckeditor.FCKeditor.toString(FCKeditor.java:223)
java.lang.String.valueOf(Unknown Source)
2.如出现Invalid file则到fckeditor下找到文件fckconfig.js修改
(1)
FCKConfig.LinkBrowserURL = FCKConfig.BasePath + 'filemanager/browser/default/browser.html?Connector=' + encodeURIComponent( FCKConfig.BasePath + 'filemanager/connectors/' + _FileBrowserLanguage + '/connector.' + _FileBrowserExtension ) ;
改为:
FCKConfig.LinkBrowserURL = FCKConfig.BasePath + 'filemanager/browser/default/browser.html?Connector=' + encodeURIComponent( FCKConfig.BasePath + 'filemanager/connectors/' + _FileBrowserLanguage + '/connector.' + _FileBrowserExtension ) ;
(2)
FCKConfig.LinkUploadURL = FCKConfig.BasePath + 'filemanager/connectors/' + _QuickUploadLanguage + '/upload.' + _QuickUploadExtension ;
改为:
FCKConfig.LinkUploadURL = FCKConfig.BasePath + 'filemanager/connectors/' + _QuickUploadLanguage + '/upload.' + _QuickUploadExtension+'?Type=File' ;