---
title: "FCKEditor学习笔记1--将FCKEditor应用到web页面（html,jsp）中"
author: "zpchen"
date: "2008-11-03T22:40:44Z"
tags: ["HTML", "JSP", "JavaScript", "Web", "fckeditor"]
slug: "fckeditor-1-fckeditor-web-html-jsp"
draft: false
lastmod: "2008-11-03T22:40:44Z"
id: 261868
url: "https://zpchen.iteye.com/blog/261868"
---

这几天闲得没事，就把FCKEditor拿来把玩了一下。顺便也把学习过程记录下来了，作为以后回忆的参考。其实学习这个东西很有用滴，就像我们最热爱的javaEye社区的编辑面板，就是利用FCKEditor来实现的，当然你会发现许多的论坛，社区什么的都是用的这个技术。

 

1.首先下载FCKEditor开发包（FCKeditor\_2.6.3.zip），解压，然后将解压出来的文件夹拷贝到MyEclipse web项目中的WebRoot目录下。

 

2.接着来分别在HTML和jsp页面中来来调用之

   HTML中实现

---2.1.1 新建一个HTML文件,在Head标签中 ，导入

  &lt;script type="text/javascript" src="fckeditor/fckeditor.js"&gt;&lt;/script&gt;

---2.1.2 ，在页面中要镶嵌FCK编辑器的地方调用如下代码：

&lt;script type="text/javascript"&gt;  
var oFCKeditor = new FCKeditor('FCKeditor1');  
//需要修改BsePath的值,前面加上   “/工程名”  
//oFCKeditor.BasePath = "/fckeditor/";  
oFCKeditor.BasePath = "/FCKEditor/fckeditor/";  
//当前页应用配置myconfig.js  
oFCKeditor.Config\["CustomConfigurationsPath"] = "/FCKEditor/js/myconfig.js"  ;  
oFCKeditor.Create();  
&lt;/script&gt;

需要说明的是：路径中的蓝色部分为项目名称FCKEditor，前面要加“/”。

  非常简单，运行下改页面你久会看到效果了，当然调用方法还有其他的方式

  详见：[http://docs.fckeditor.net/FCKeditor\_2.x/Developers\_Guide/Integration/JavaScript](http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/Integration/JavaScript)

  JSP中实现

---2.2.1 新建一个jsp文件

---2.2.2 在页面开头位置导入标签库&lt;%@ taglib uri="[http://java.fckeditor.net](http://java.fckeditor.net)" prefix="FCK" %&gt;

，然后在具体位置调用标签

  &lt;FCK:editor instanceName="zpchen"  basePath="/fckeditor" value="  "&gt;&lt;/FCK:editor&gt;

运行该页面也能看到效果了。

 

  下一篇将讲解FCKEditor自定义配置，包括表情，语言，功能选项等。