基于ckeditor的在JSP中显示文本编辑页面



基于ckeditor的在JSP中显示文本编辑页面

最近没事就测试了一下在JSP页面中嵌入基于ckeditor的编辑页面,首先要去ckeditor的官网上下载ckeditor,也可以在这里下载http://download.csdn.net/detail/kezhongke/4867921我的是ckeditor3.x的,现在最新的应该是ckeditor4啦。下载好之后解压得到ckeditor,然后将其拷到WEB项目的WebRoot目录下,
然后运行服务器,输入网址:http://localhost:8080/Ckeditor/ckeditor/_samples/index.html。如果出现相关信息说明安装成功。
接着在JSP页面中需要添加如下部分内容:
1、引入标签:
[html] view plaincopyprint?
<%@ taglib uri=”http://ckeditor.com” prefix=”ckeditor” %>
2、添加入下内容,记住ckeditor必须得放到body标签结束的上边,也就是在body的最后一个标签
[html] view plaincopyprint?
<body>
<center>
<textarea cols=”80″ id=”editor1″ name=”editor1″ rows=”10″></textarea>
</center> <span style=”font-family: SimSun;”><ckeditor:replace replace=”editor1″ basePath=”/Ckeditor/ckeditor/” /> </span><span style=”font-family: SimSun;”></body></span>

之后输入相应的地址,在浏览器中看看效果吧!