FCKeditor for JSP

Source: Internet
Author: User
Tags zip folder

Before using FCKeditor in JSP, let's first understand what FCKeditor is, and then fully introduce the use of FCKeditor in JSP.

FCKeditor is an open-source project on sourceforge.net. It mainly implements the online web editor function and enables web programs to have powerful editing functions such as MS Word. Official Website for http://www.fckeditor.net, server support ASP. Net, ASP, ClodFusion, PHP, Java and other languages, and support IE 5 +, Mozilla, Netscape and other mainstream browsers.

Download Fckeditor from the official website. Note that there are two packages: The main file and the JSP integration package.

1. Decompress fckeditor_2.2.zip (main file of FCKeditor) and copy the FCKeditor directory to the root directory of the website,

2. Decompress fckeditor-2.3.zip, (JSP, FCKeditor Integration package), role: This is the JSP Integration Pack for using FCKeditor inside a java server page without the complexity of using a Java scriptlets or the javascript api.

3. Copy the two servlets in FCKeditor-2.3/web/WEB-INF/web. xml, servlet-mapping definition to the web. xml file of your project, modify

 
 
  1. <servlet-mapping>   
  2. <servlet-name>Connector</servlet-name>   
  3. <url-pattern>/editor/filemanager/browser/default/connectors/jsp/connector
  4. </url-pattern>   
  5. </servlet-mapping>   
  6.  
  7. <servlet-mapping>   
  8. <servlet-name>SimpleUploader</servlet-name>   
  9. <url-pattern>/editor/filemanager/upload/simpleuploader</url-pattern> 
  10. </servlet-mapping>  

Is

 
 
  1. <servlet-mapping>   
  2. <servlet-name>Connector</servlet-name>   
  3. <url-pattern>/FCKeditor/editor/filemanager/browser/default/connectors/jsp/connector
    </url-pattern>   
  4. </servlet-mapping>   
  5.  
  6. <servlet-mapping>   
  7. <servlet-name>SimpleUploader</servlet-name>   
  8. <url-pattern>/FCKeditor/editor/filemanager/upload/simpleuploader</url-pattern> 
  9. </servlet-mapping>  

4. copy the files under the FCKeditor-2.3/web/WEB-INF/lib directory to the lib folder of your project

5. Add:

 
 
  1. // Add at the beginning of the file
  2. <% @ TaglibUri=Http://fckeditor.net/tags-fckeditor" Prefix="FCK"%>
  3. // Add the desired location
  4. <FCK: editor Id="Content" BasePath="/FCKeditor /"
  5. ImageBrowserURL="/FCKeditor/editor/filemanager/browser/default/browser.html?
    Type = Image & Connector = connectors/jsp/connector"
  6. LinkBrowserURL="/FCKeditor/editor/filemanager/browser/default/browser.html?
    Connector = connectors/jsp/connector"
  7. FlashBrowserURL="/FCKeditor/editor/filemanager/browser/default/browser.html?
    Type = Flash & Connector = connectors/jsp/connector"
  8. ImageUploadURL="/FCKeditor/editor/filemanager/upload/simpleuploader? Type = Image"
  9. LinkUploadURL="/FCKeditor/editor/filemanager/upload/simpleuploader? Type = File"
  10. FlashUploadURL="/FCKeditor/editor/filemanager/upload/simpleuploader? Type = Flash">
  11. This is default content :)
  12. </FCK: editor>

Start the server test .... After success, the FCKeditor will be reduced.
1. Delete all folders starting with "_" in the FCKeditor directory and subdirectory
2. Only fckconfig. js, FCKeditor. js, fckstyles. xml, and fcktemplates. xml are retained in the root directory of fckeditor.
3. Clear the files and folders in the editor/filemanager/upload directory.
4. You can also delete the skin files under the editor/skins directory, leaving only the default skin if you do not need to change the skin)
5. you can also delete the files in the editor/lang directory and retain only en. js, fck1_agemanager. js, zh-cn.js, zh. js files can be in English, simplified Chinese, or traditional Chinese :))

Finished. Is it refreshing now?

Other problems:

When used in struts + spring + hibernate, The image upload function may report The following error: The output format must have a' {http://xml.apache.org/xalan=content-handler' property! If the error occurs, try removing xalan *. jar under the WEB-INF/lib directory.

Security Questions:

If FCKeditor can be used by common users on the front end, pay attention to related security issues. Do not use the default ToolBar when using the front end,
To remove the Add image, flash, and image domain buttons
In fckconfig. js, about 78 rows are configured with values in those arrays, just like a function on the interface. You can force each group of values to try out what they represent.

The fckeditorinstallation is complete. For detailed configuration, see the examples in the web/_ samples directory in the fckeditor-2.3.zip folder (JSP, FCKeditor integration package.

  1. Detailed analysis of JSP and BEAN
  2. Call jsp el expressions with parameter Methods
  3. JSP and JavaBean Models
  4. Detailed description of JSP development environment Configuration
  5. Servlet and JSP experience

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.