Using FCKeditor control in JSP page (JS usage)


It can be combined with PHP, JavaScript, ASP,, ColdFusion, Java, ABAP and other programming languages“ “Fck” in the name of “FCKeditor” is the abbreviation of Frederico Caldeira knabben, the author of the editor.

The fckeeditor control can be downloaded from the official website, this example mainly uses FCKeditor_ Readers can download some contents in,,

1. Unpack FCKeditor_ to copy the FCKeditor folder under WEB-INF, which can be used directly later.

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

Mode 1: Javascript mode

(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: the editor is imported 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 is defaultoffckedit. 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/"; // note the relative path here // ofckeditor. Basepath    = "/ FCKEditTest/fckeditor/"; oFCKeditor.ReplaceTextarea();}</ Script > < / head > < body > method 2: import the editor through textarea < br > < textarea rows = "4" cols = "60" name = "mytextarea" > this is a value < / textarea > < / body > < / HTML >
Method 2: before using FCKeditor, you need to build an environment. Copy 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 in package and slf4j-simple-1.5.2.jar in package to the Lib directory, and build the environment. After construction, it can be used in JSP page. See page method for details_ jsp.jsp<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%><%@ taglib uri=" " 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 with a corresponding value, and the value cannot be empty. The version here is 2.6.3, and the problem has been solved FCK:editor instanceName="myEditor" basePath="/fckeditor"></FCK:editor></body></html>

Recommended Today

Implementation example of go operation etcd

etcdIt is an open-source, distributed key value pair data storage system, which provides shared configuration, service registration and discovery. This paper mainly introduces the installation and use of etcd. Etcdetcd introduction etcdIt is an open source and highly available distributed key value storage system developed with go language, which can be used to configure sharing […]