The use of FCKeditor in Java

Source: Internet
Author: User
Tags rar

According to an online article on the Guide to test FCKeditor, found Fckeditor_2.2.rar bag in the/fckeditor_2.2/fckeditor/editor/filemanager no JSP folder, feel strange. Think that the developer forgot to pack in the inside (haha, ridiculous), and then download the old version of the view, or not, depressed ...

So look at the source code in the Fckeditor-java-.rar, the source code changed, itself is configurable, let me give up, hey. Modified is the Com.fredck.FCKeditor.uploader.SimpleUploaderServlet init method, all of which are hard-coded:
public void Init () throws Servletexception {

Debug=true;

if (Debug) System.out.println ("/r/n----simpleuploaderservlet initialization started----");

Basedir= "/userfiles/";
Enabled=true;
String Realbasedir=getservletcontext (). Getrealpath (BaseDir);
File Basefile=new file (Realbasedir);
if (!basefile.exists ()) {
Basefile.mkdir ();
}

Allowedextensions = new Hashtable (3);
Deniedextensions = new Hashtable (3);

Allowedextensions.put ("File", Stringtoarraylist (""));
Deniedextensions.put ("File", Stringtoarraylist ("php|php3|php5|phtml|asp|aspx|ascx|jsp|cfm|cfc|pl|bat|exe|dll| reg|cgi "));

Allowedextensions.put ("Image", Stringtoarraylist ("jpg|gif|jpeg|png|bmp"));
Deniedextensions.put ("Image", Stringtoarraylist (""));

Allowedextensions.put ("Flash", Stringtoarraylist ("Swf|fla"));
Deniedextensions.put ("Flash", Stringtoarraylist (""));

if (Debug) System.out.println ("----simpleuploaderservlet initialization completed----/r/n");

}

Then modify the/fckeditor/fckconfig.js

Fckconfig.linkbrowserurl = Fckconfig.basepath + ' filemanager/browser/default/browser.html? Connector=/servlet/com.fredck.fckeditor.connector.connectorservlet ';

Fckconfig.imagebrowserurl = Fckconfig.basepath + ' filemanager/browser/default/browser.html? Type=image&connector=/servlet/com.fredck.fckeditor.connector.connectorservlet ';

Fckconfig.flashbrowserurl = Fckconfig.basepath + ' filemanager/browser/default/browser.html? Type=flash&connector=/servlet/com.fredck.fckeditor.connector.connectorservlet ';

Fckconfig.linkuploadurl = '/servlet/com.fredck.fckeditor.uploader.simpleuploaderservlet ';

Fckconfig.imageuploadurl = '/servlet/com.fredck.fckeditor.uploader.simpleuploaderservlet? Type=image ';

Fckconfig.flashuploadurl = '/servlet/com.fredck.fckeditor.uploader.simpleuploaderservlet? Type=flash ';

Then you can test the example below Fckeditor-java.rar.

Originally can support asp,php ... Now all make support Java, hehe ...

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.