首页后端开发其他后端知识JSP 页面中使用FCKeditor控件(js用法)

JSP 页面中使用FCKeditor控件(js用法)

时间2024-02-08 02:09:02发布访客分类其他后端知识浏览962
导读:收集整理的这篇文章主要介绍了JSP 页面中使用FCKeditor控件(js用法 ,觉得挺不错的,现在分享给大家,也给大家做个参考。 它可和PHP、JavaScript、ASP、ASP.N...
收集整理的这篇文章主要介绍了JSP 页面中使用FCKeditor控件(js用法),觉得挺不错的,现在分享给大家,也给大家做个参考。

它可和PHP、JavaScript、ASP、ASP.NET、Coldfusion、Java、以及ABAP等不同的编程语言相结合。“fcKedITor”名称中的“FCK” 是这个编辑器的作者的名字Frederico Caldeira Knabben的缩写。

FCKeditor控件请到官方网站下载http://www.fckeditor.net,本例主要用到FCKeditor_2.6.3.zip、fckeditor-java-demo-2.4.1.zip、fckeditor-java-2.4.1-bin.zip里面的一些内容,读者可以自行下载。

1. 解开压缩包FCKeditor_2.6.3.zip,将其中的fckeditor文件夹复制到WEB-iNF下面,后面可以直接使用。

2. 在页面中使用FCKeditor有两种方式。

方式一:JavaScript的方式

(1)直接使用,见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>
方法一:通过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";
//默认是default
oFCKeditor.ToolbarSet="Default";
oFCKeditor.Create() ;
</script>
<hr>
</body>
</html>

(2)通过Textarea,祥见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/";  //这里注意相对路径
//oFCKeditor.BasePath   = "/FCKEditTest/fckeditor/";
oFCKeditor.ReplaceTextarea();
}
</script>
</head>
<body>
方法二:通过Textarea来实现的实现编辑器导入<br>
<textarea rows="4" cols="60" name="MyTextarea">this is a value</textarea>
</body>
</html>

方式二:在标签使用FCKeditor

在使用标签之前,需要搭建环境。将fckeditor-java-2.4.1-bin.zip包中的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以及包fckeditor-java-demo-2.4.1.zip中的slf4j-simple-1.5.2.jar复制到lib目录下,并构建环境。

构建完后,就可以在JSP页面中进行使用。祥见页面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>
早些版本必需将fckeditor的Value属性必需指定对应的值,且值不能为空。
而此处版本是2.6.3,该问题已经解决。
<FCK:editor instanceName="myEditor" basePath="/fckeditor"></FCK:editor>
</body>
</html>
您可能感兴趣的文章:
  • JS操作Fckeditor的一些常用方法(获取、插入等)
  • JS集成fckeditor及判断内容是否为空的方法
  • js判断FCKeditor内容是否为空的两种形式
  • FCKeditorAPI 手册 js操作获取等
  • fckeditor常用Js,获取fckeditor内容,统计fckeditor字数,向fckeditor写入指定代码
  • Js FCKeditor的值获取和修改的代码小结
  • javascript fckeditor编辑器取值与赋值实现代码
  • FCKEditor常用Js代码,获取FCK内容,统计FCK字数,向FCK写入指定代码
  • FCKeditor提供了一个完整的JavaScript API
  • javascript 获取FCKeditor内容
  • extjs fckeditor集成代码
  • jsp fckeditor 上传中文图片乱码问题的解决方法
  • 使用Js获取、插入和更改FCKeditor编辑器里的内容

声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!


若转载请注明出处: JSP 页面中使用FCKeditor控件(js用法)
本文地址: https://pptw.com/jishu/604861.html
Java 创建cookie和删除cookie jsp 不支持EL表达式,解决办法

游客 回复需填写必要信息