JSP things (10)-FCKeditor usage highlights

Source: Internet
Author: User
Document directory
  • I. FCKeditor Introduction
  • Ii. Download
  • Iii. deployment configuration
  • Iv. Test page
I. FCKeditor Introduction

FCKeditorIs a WYSIWYG text editor dedicated to open source on the web page. It is lightweight and can be used without complicated installation steps. It can be combined with different programming languages such as PHP, JavaScript, ASP, ASP. NET, ColdFusion, Java, and ABAP. "Fck" in the "FCKeditor" name is the abbreviation of the author's name Frederico Caldeira knabben.

FCKeditor is compatible with most Web browsers, such as Internet Explorer 5.5 + (Windows), Mozilla Firefox 1.0 +, Mozilla 1.3 +, and Netscape 7 +. Support for opera will be added in future versions.

Ii. Download

1. Official download home: http://www.fckeditor.net/download/

2. Need to download FCKeditor 2.6.4: http://nchc.dl.sourceforge.net/project/fckeditor/FCKeditor/2.6.4.1/FCKeditor_2.6.4.1.zip

And FCKeditor. Java: http://nchc.dl.sourceforge.net/project/fckeditor/FCKeditor.Java/2.3/FCKeditor-2.3.zip

Iii. deployment configuration

1. Decompress FCKeditor 2.6.4 and copy the FCKeditor folder to/webroot /.
2、fckeditor-2.3.zip unzip, copy commons-fileupload.jar and FCKeditor-2.3.jar to/webroot/WEB-INF/lib/
3. Modify the/webroot/WEB-INF/Web. xml file and add the following content:

<Servlet> <br/> <servlet-Name> connector </servlet-Name> <br/> <servlet-class> COM. fredck. FCKeditor. connector. connectorservlet </servlet-class> <br/> <init-param> <br/> <param-Name> basedir </param-Name> <br/> <param-Value >/userfiles/</param-value> <br/> </init-param> <br/> <param-Name> debug </param-Name> <br/> <param-value> true </param-value> <br/> </init-param> <br/> <load-on- startup> 1 </load-on-startup> <br/> </servlet> </P> <p> <servlet> <br/> <servlet-Name> simpleuploader </servlet-Name> <br/> <servlet-class> COM. fredck. FCKeditor. uploader. simpleuploaderservlet </servlet-class> <br/> <init-param> <br/> <param-Name> basedir </param-Name> <br/> <param-Value >/userfiles/</param-value> <br/> </init-param> <br/> <param-Name> debug </param-Name> <br/> <param-value> true </param-value> <br/> </init-param> <br/> <init-param> <br/> <param-Name> enabled </param-Name> <br/> <param-value> true </param-value> <br/> </init- param> <br/> <init-param> <br/> <param-Name> allowedextensionsfile </param-Name> <br/> <param-value> </param- value> <br/> </init-param> <br/> <param-Name> deniedextensionsfile </param-Name> <br/> <param-value> PHP | php3 | PhP5 | phtml | ASP | aspx | ascx | JSP | CFM | CFC | PL | bat | exe | DLL | Reg | CGI </Param -value> <br/> </init-param> <br/> <param-Name> allowedextensionsimage </param-Name> <br /> <param-value> JPG | GIF | JPEG | PNG | BMP </param-value> <br/> </init-param> <br/> <init-Param> <br/> <param-Name> deniedextensionsimage </param-Name> <br/> <param-value> </param-value> <br/> </init- param> <br/> <init-param> <br/> <param-Name> allowedextensionsflash </param-Name> <br/> <param-value> SWF | FLA </param-value> <br/> </init-param> <br/> <param-Name> deniedextensionsflash </param-Name> <br/> <param-value> </param-value> <br/> </init-param> <br/> <load-on-startup> 1 </load -On-startup> <br/> </servlet> </P> <p> <servlet-mapping> <br/> <servlet-Name> connector </servlet-name> <br/> <URL-pattern>/FCKeditor/connector </url-pattern> <br/> </servlet-mapping> </P> <p> <servlet- mapping> <br/> <servlet-Name> simpleuploader </servlet-Name> <br/> <URL-pattern>/FCKeditor/simpleuploader </url-pattern> <br/> </servlet-mapping>

Iv. Test page

0. Create a test page named test. jsp.

1. Add CSS and JS Code first: the specific path is based on the relative location of your page and Related Files

<Link href = ".. /.. /.. /FCKeditor/_ samples/sample.css "mce_href =" FCKeditor/_ samples/sample.css "rel =" stylesheet "type =" text/CSS "/> <br/> <MCE: script Type = "text/JavaScript" src = ".. /.. /.. /FCKeditor. JS "mce_src =" FCKeditor/FCKeditor. JS "> </MCE: SCRIPT>

2. Add the following code:

<% <Br/> string content = request. getparameter ("content"); <br/> If (content! = NULL) {<br/> content = content. replaceall ("/R/N", ""); <br/> content = content. replaceall ("/R", ""); <br/> content = content. replaceall ("/N", ""); <br/> content = content. replaceall ("/" "," '"); <br/>} else {<br/> content = ""; <br/>}< br/>%> <br/> <span> <br/> <SCRIPT type = "text/JavaScript"> <br/> var ofckeditor = new FCKeditor ('content '); // The input parameter is the name of the form element (input or textarea generated by FCKeditor) <br/> ofckeditor. basepath = '.. /.. /.. /FCKeditor/'; // specify the root path of FCKeditor, that is, FCKeditor. path of JS <br/> ofckeditor. height = '000000'; <br/> ofckeditor. value = "<% = content %>"; // default value <br/> ofckeditor. create (); <br/> </SCRIPT> <br/> </span>

3. You can view the following page (this article only contains key code ):

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.