The JSP page USES the FCKeditor control of js

  • 2020-05-12 03:01:42
  • OfStack

It can be combined with different programming languages such as PHP, JavaScript, ASP, ASP.NET, ColdFusion, Java, and ABAP. The "FCK" in the "FCKeditor" name is a contraction of the editor's author's name, Frederico Caldeira Knabben.

Please visit the official website to download http FCKeditor controls: / / www fckeditor. net, this case is mainly used FCKeditor_2. 6.3 zip, fckeditor java - demo - against 2.4.1. zip, fckeditor java - against 2.4.1 - bin. zip 1 some of the contents, the reader can download.

1. Unzip FCKeditor_2.6.3.zip and copy the fckeditor folder under WEB-INF, which can be directly used later.

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

Mode 1: JavaScript mode

(1) direct use, see method1.html


The < html >
The < head >
< script type="text/javascript" src="fckeditor/ fckeditor. js" > < /script >
< / head >
The < body >
Method 1: import < br > into the implementation editor via JavaScript
< 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 is default
oFCKeditor.ToolbarSet="Default";
oFCKeditor.Create() ;
< / script >
The < hr >
< / body >
< / html >

(2) through Textarea, see method2.html


The < html >
The < 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/"; // notice the relative path here
//oFCKeditor.BasePath = "/FCKEditTest/fckeditor/";
oFCKeditor.ReplaceTextarea();
}
< / script >
< / head >
The < body >
Method 2: import < br > into the implementation editor via Textarea
< textarea rows="4" cols="60" name="MyTextarea" > this is a value < /textarea >
< / body >
< / html > < / pre >

Option 2: use FCKeditor on the label

Before you can use the tag, you need to set up the environment. fckeditor-java-2.4.1-bin.zip package fckeditor-java-core-2.4.1.jar, commons-fileupload-1.2.1.jar, commons-io-1.3.2.jar, slf4j-api-1.5.2.jar package fckeditor-java-es211 Copy the slf4j-simple-1.5.2.jar in en-2.4.1.zip to the lib directory and build the environment.

Once you've built it, you can use it on the JSP page. See page method_jsp.jsp for details

< % @page language="java" import=" java. util.*" pageEncoding=" utf-8 "% >
The < % @ taglib uri = "http: / / java. fckeditor. net" prefix = "FCK % >"

The < html >
The < head >
< title > method_jsp.jsp < /title >
< / head >
The < body >
Earlier versions had to specify a value for the Value property of fckeditor, and the value could not be null.
The version here is 2.6.3, which has been resolved.
< FCK:editor instanceName="myEditor" basePath="/fckeditor" > < /FCK:editor >
< / body >
< / html > < / pre > < / pre > < / pre >


Related articles: