Use FCKeditor controls in JSP pages (js usage)

Source: Internet
Author: User

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.

Download the FCKeditor Control from the official website.Http://www.fckeditor.netYou can download some content in the notebook.

1. Open the compressed package fckeditor_2.6.3.zip, copy the fckeditor folder to the WEB-INF, which can be directly used later.

2. There are two ways to use FCKeditor on the page.

Method 1: JavaScript

(1)for direct use, see method1.html

<! Doctype html public "-// W3C // dtd html 4.01 Transitional // EN">
<Html>
<Head>
<Script type = "text/javascript" src = "fckeditor/fckeditor. js"> </script>
</Head>
<Body>
Method 1: Implement editor import through JavaScript <br>
<Script type = "text/javascript">
Var oFCKeditor = new FCKeditor ('fckeditor1 ');
OFCKeditor. BasePath = "fckeditor /";
// OFCKeditor. BasePath = "/FCKEditTest/fckeditor /";
OFCKeditor. Width = "50% ";
OFCKeditor. Height = "400 ";
OFCKeditor. Value = "initial value ";
// OFCKeditor. ToolbarSet = "Basic ";
// The default value is default.
OFCKeditor. ToolbarSet = "Default ";
OFCKeditor. Create ();
</Script>
<Hr>
</Body>
</Html>

(2)through textarea, see method2.html

<! Doctype html public "-// W3C // dtd html 4.01 Transitional // EN">
<Html>
<Head>
<Script type = "text/javascript" src = "fckeditor/fckeditor. js"> </script>
<Script type = "text/javascript">
Window. onload = function (){
Var oFCKeditor = new FCKeditor ('mytextarea ');
OFCKeditor. BasePath = "fckeditor/"; // pay attention to the relative path
// OFCKeditor. BasePath = "/FCKEditTest/fckeditor /";
OFCKeditor. ReplaceTextarea ();
}
</Script>
</Head>
<Body>
Method 2: Implement editor import through Textarea <br>
<Textarea rows = "4" cols = "60" name = "MyTextarea"> this is a value </textarea>
</Body>
</Html>

Method 2: Use FCKeditor on tags

Before using tags, you need to build an environment. Copy the slf4j-simple-1.5.2.jar in idea to the lib directory and build the environment.

After the construction, you can use it on the JSP page. See method_jsp.jsp.

<% @ Page language = "java" import = "java. util. *" pageEncoding = "UTF-8" %>
<% @ Taglib uri = "http://java.fckeditor.net" prefix = "FCK" %>
<! Doctype html public "-// W3C // dtd html 4.01 Transitional // EN">
<Html>
<Head>
<Title> method_jsp.jsp </title>
</Head>
<Body>
In earlier versions, the Value attribute of fckeditor must be specified and the Value cannot be blank.
The version 2.6.3 has been resolved.
<FCK: editor instanceName = "myEditor" basePath = "/fckeditor"> </FCK: editor>
</Body>
</Html>

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.