fckeditor_2.6.4 + fckeditor-java-2.4.1-bin Online edit page JSP implementation __JS

Source: Internet
Author: User

Recently has been studying fckeditor editors, online to find some information.

One, File download

1): Fckeditor_2.6.4.zip (main file package, contains the main style CSS, templates, js file)
Address: Http://nchc.dl.sourceforge.net/sourc...itor_2.6.4.zip

2): Fckeditor-java-2.4.1-bin.zip (Java support package) address Http://nchc.dl.sourceforge.net/sourc...-2.4.1-bin.zip

3) Slf4j-1.5.6.zip Address: Http://slf4j.org/dist/slf4j-1.5.6.zip

Version Description:

Because FCKeditor for Java 2.4 has made a lot of changes relative to 2.3, these changes make it easier to configure our fckeditor. For example:
The base package name is changed from: Com.fredck.FCKeditor to Net.fckeditor.
File upload Simpleuploaderservle integrated into the Connectorservlet inside, web,xml configuration is much simpler

Second, the environment to build

MyEclipse 7.0+apache-tomcat-6.0.18+jdk1.5

Third, configure

1. New Web Project Newdemo

2. Copy the FCKeditor folder in Fckeditor_2.6.4.zip to Webroot, Commons-fileupload-1.2.1.jar,commons-io-1.3.2.jar, Fckeditor-java-core-2.4.1.jar,slf4j-api-1.5.6.jar,slf4j-simple-1.5.6.jar or Slf4j-jdk14-1.5.6.jar, a total of 5 packages are imported into the project.

Note, however, that the official latest version of 2009-2-4,SLF4J is 1.5.6, but the SLF4J-API provided by FCKeditor is 1.5.2, and if two versions are different, you will see the following message on the console:

Serious: Servlet/java threw load () exception
java.lang.IllegalAccessError:tried to access field Org.slf4j.impl.StaticLoggerBinder.SINGLETON from class

Org.slf4j.LoggerFactory

So be sure to pay attention to version consistency issues.

3. Create a new file fckeditor.properties under the src/directory, add content: connector.useractionimpl= Net.fckeditor.requestcycle.impl.UserActionImpl can be saved.
4.web.xml modification

<?xml version= "1.0" encoding= "UTF-8"?>
<web-app version= "2.5"
Xmlns= "Http://java.sun.com/xml/ns/javaee"
Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"
Xsi:schemalocation= "Http://java.sun.com/xml/ns/javaee
Http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd ">
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>

<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>
<!--don't wrap this line otherwise Glassfish'll fail to load this file-->
<url-pattern>/fckeditor/editor/filemanager/connectors/*</url-pattern>
</servlet-mapping>

</web-app>

5. Modify the configuration file

Modifying the Fckconfig.js component configuration file

Template Style Modification

Fckconfig.skinpath = Fckconfig.basepath + ' skins/silver/';

Default language modifications

Fckconfig.defaultlanguage = ' ZH-CN ';

Path to file browsing (FckEditor for Java 2.4, older versions such as FckEditor for Java 2.3 are needed to be modified)

Fckconfig.linkbrowserurl

Fckconfig.imagebrowserurl

Fckconfig.flashbrowserurl

The path of the upload file (new version FCKeditor for Java 2.4 is not required to be modified, and older versions such as FCKeditor for Java 2.3 are needed to be modified)

Fckconfig.linkuploadurl

Fckconfig.flashuploadurl

Fckconfig.imageuploadurl

6. Create a new Folder

Webroot New Userfiles folder below, Userfiles new File,image,flash,media 4 folders below

7. New JSP

Under the Engineering directory Webroot new index.jsp,result.jsp two files,
Index.jsp:1. <%@ page language= "java" import= "java.util.*" pageencoding= "UTF-8"%>
2. <%@ taglib uri= "http://java.fckeditor.net" prefix= "FCK"%>
3. <%
4. String path = Request.getcontextpath ();
5. String basepath = request.getscheme () + "://" +request.getservername () + ":" +request.getserverport () +path+ "/";
6.%>
7. <! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" >
8. 9. <base href= "<%=basePath%>" >
<title>fckeditor.java2.4 for Fckeditor2.6.3beate text</title>
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<meta http-equiv= "Pragma" content= "No-cache" >
<meta http-equiv= "Cache-control" content= "No-cache" >
<meta http-equiv= "Expires" content= "0" >
<meta http-equiv= "keywords" content= "keyword1,keyword2,keyword3" >
<meta http-equiv= "description" content= "This are my page" >
<body>
<form action= "result.jsp" method= "POST" >
<fck:editor instancename= "Content" >
<jsp:attribute name= "Value" >
23. Your content ...
</jsp:attribute>
</FCK:editor>
<input type= "Submit" value= "submitted" >
</form>
28.
</body>
result.jsp
1. <%@ page language= "java" import= "java.util.*" pageencoding= "UTF-8"%>
2. <%
3. String path = Request.getcontextpath ();
4. String basepath = request.getscheme () + "://" +request.getservername () + ":" +request.getserverport () +path+ "/";
5.%>
6. <! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" >
7. 8. 9. <base href= "<%=basePath%>" >
<title>my JSP ' result.jsp ' starting page</title>
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<meta http-equiv= "Pragma" content= "No-cache" >
<meta http-equiv= "Cache-control" content= "No-cache" >
<meta http-equiv= "Expires" content= "0" >
<meta http-equiv= "keywords" content= "keyword1,keyword2,keyword3" >
<meta http-equiv= "description" content= "This are my page" >
<body>
<%=request.getparameter ("content")%>
</body>



In IE address input: Http://localhost:8080/newDemo OK, successful.

6. Garbled problem.

result.jsp add <%request.setcharacterencoding ("UTF-8");%> such garbled problem can be solved.

Other problems, such as uploading pictures of the Chinese name of the garbled to be resolved ....

7. Note that the FCKeditor version problem

FckEditor for Java 2.3 or earlier versions of the configuration file need to be fckconfig.js inside the

1. Change the path of file browsing:

Fckconfig.linkbrowserurl = Fckconfig.basepath + "filemanager/browser/default/browser.html?" Connector=connectors/jsp/connector ";

Fckconfig.imagebrowserurl = Fckconfig.basepath + "filemanager/browser/default/browser.html?" Type=image&connector=connectors/jsp/connector ";

Fckconfig.flashbrowserurl = Fckconfig.basepath + "filemanager/browser/default/browser.html?" Type=flash&connector=connectors/jsp/connector ";

2. Change the path of the uploaded file

Fckconfig.linkuploadurl = Fckconfig.basepath + ' Filemanager/upload/simpleuploader? Type=file ';

Fckconfig.flashuploadurl = Fckconfig.basepath + ' Filemanager/upload/simpleuploader? Type=flash ';

Fckconfig.imageuploadurl = Fckconfig.basepath + ' Filemanager/upload/simpleuploader? Type=image ';

At the same time, web.xml documents should be amended

<servlet>
<servlet-name>Connector</servlet-name>
<servlet-class>com.fredck.FCKeditor.connector.ConnectorServlet</servlet-class>
<init-param>
<param-name>baseDir</param-name>
<param-value>/userfiles/</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet>
<servlet-name>SimpleUploader</servlet-name>
<servlet-class>com.fredck.FCKeditor.uploader.SimpleUploaderServlet</servlet-class>
<init-param>
<param-name>baseDir</param-name>
<param-value>/userfiles/</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>enabled</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>AllowedExtensionsFile</param-name>
<param-value></param-value>
</init-param>
<init-param>
<param-name>DeniedExtensionsFile</param-name>
<param-value>php|php3|php5|phtml|asp|aspx|ascx|jsp|cfm|cfc|pl|bat|exe|dll|reg|cgi</param-value>
</init-param>
<init-param>
<param-name>AllowedExtensionsImage</param-name>
<param-value>jpg|gif|jpeg|png|bmp</param-value>
</init-param>
<init-param>
<param-name>DeniedExtensionsImage</param-name>
<param-value></param-value>
</init-param>
<init-param>
<param-name>AllowedExtensionsFlash</param-name>
<param-value>swf|fla</param-value>
</init-param>
<init-param>
<param-name>DeniedExtensionsFlash</param-name>
<param-value></param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

<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>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.