Using fckeditor__jsp in JSP

Source: Internet
Author: User

Calling through JavaScript

First step: Copy the FCKeditor resource folder to Webroot

Step two: fetching JavaScript files

<script type= "Text/javascript" src= "Fckeditor/fckeditor.js" ></script>

Step three: Output code for JavaScript calls.

Method One: Create and enter an editor.

<script type= "Text/javascript" >

* Create a FCKeditor instance called ' FCKeditor1 '

var ofckeditor = new FCKeditor (' FCKeditor1 ');

The *basepath Editor's baseline path defaults to:/fckeditor/

Represents the path of the current site: http://localhost:8080/fckeditor/

So the path is:/Engineering name/fckeditor/, example: (/fcktese/fckeditor/)

Ofckeditor.basepath = "/fcktest/fckeditor/";

Ofckeditor.width= "60%";

ofckeditor.height= "500";

Ofckeditor.toolbarset= "Basic";

Create FCKeditor

Ofckeditor.create ();

</script>

Method Two: Replace a testarea element with an editor

Add the following code to the head:

<script type= "Text/javascript" >

Window.onload = function ()

{

Mytextarea is the name of the textarea

var ofckeditor = new FCKeditor (' Mytextarea ');

Ofckeditor.basepath = "/fcktest/fckeditor/";

Ofckeditor.replacetextarea ();

}

</script>

Add the following code to the body:

<textarea id= "Mytextarea" name= "Mytextarea" ></textarea>

Note: 1. BasePath to set up correctly

2.BasePath must end with '/'

Properties of the FCKeditor object

Property name

Description

Default Value

Width

Width

100%

Height

Height

200

Value

Editor initialization content

(empty string)

ToolbarSet

The name of the toolbar collection (built-in default and basic, or custom)

Default

BasePath

Base Path of editor

/fckeditor/

The construction method of FCKeditor

Builder:

Var fckeditor=function (Instancename,width,height,toolbarset,value)

where InstanceName is the value of the Name property of the textarea element that is output by the editor, you must make

parameter is assigned to the property with the same name

Calling FCKeditor through custom tags in a JSP

The first step is to add a jar package under Lib

Commons-fileupload-1.2.1.jar and Commons-io-1.3.2.jar for uploading and downloading

Java-core-2.4.1.jar for FCKeditor Core pack

Slf4j-api-1.5.2.jar as Log

§ Step two: Copy the FCKeditor resource folder to the Webroot

§ Create a custom label in the third step

<%@ taglib uri= "http://java.fckeditor.net" prefix= "FCK"%>

§ Step fourth refers to FCKeditor

<fck:editor instancename= "user" basepath= "/fckeditor" width= "70%" height= "value =" "></FCK:editor>

BasePath: The '/' begins with '/' to represent the path of the current project, so use the default to

InstanceName: Must specify

The Value property must be specified in the old version and cannot be an empty string.

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.