1.把下载的fckeditor文件夹访如WebRoot文件夹中 文件夹结构目录:WebRoot----fckeditor/.....
----news/newsadd.jsp
2.在news文件夹新建newsadd.jsp
<html>
<head>
<title>My JSP</title>
<!-- 1,引入js文件 -->
<script type="text/javascript" src="../fckeditor/fckeditor.js"></script>
</head>
<!-- END HEAD -->
<body>
<form action="AddNews.action" method="post">
<table class="table table-striped table-hover table-bordered">
<tr class="">
<td>
标题:<input type="text" name="news.title" size="80"/>
</td>
<td>
<input type="submit" value="提交" />
</td>
</tr>
<tr>
<td>
内容:
</td>
</tr>
<tr>
<td>
<textarea style="" rows="80" cols="80" name="news.content"></textarea>
<!-- 2,在要显示的地方写一段js代码 -->
<script type="text/javascript">
var oFCKeditor = new FCKeditor('news.content') ; // 表单提交时传递的参数名
oFCKeditor.BasePath
= "../fckeditor/" ; // 这个属性一定要设置,指定FCKeditor文件夹里所在的路径,一定要是以'/'结属。
oFCKeditor.Height
= 300 ;
oFCKeditor.Width
= 700 ;
oFCKeditor.ToolbarSet = "bbs"; // 使用指定的工具栏配置,默认为Default,我这里自定义了一个叫bbs的工具栏,去掉了几个功能
oFCKeditor.ReplaceTextarea(); // 替换指定name的textarea(隐藏textarea,显示FCKeditor)
</script>
</td>
</tr>
</table>
</form>
</body>
</html>
3.测试新闻添加成功
4.测试查看新闻成功
注意:省略了action的后台代码,并且自定义了工具栏(demo里有),图片上传功能也不能使用,只能放在线图片url。如果实现上传功能,得按照demo在服务器配置