<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/FCKeditor" prefix="FCK" %>
<%@ page language="java" import="com.fredck.FCKeditor.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>测试FCK</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
方法一:<br>
<form action="show.jsp" method="post" target="_blank">
<FCK:editor id="content" basePath="/db/fckeditor/" width="600" height="480" skinPath="/db/fckeditor/editor/skins/silver/"
toolbarSet = "Default" >
默认内容测试
</FCK:editor>
<input type="submit" value="Submit">
</form>
<br><br><br>
方法二:<br>
<form action="show.jsp" method="post" target="_blank">
<%
FCKeditor oFCKeditor ;
oFCKeditor = new FCKeditor(request,"content") ;
oFCKeditor.setBasePath( "/db/fckeditor/" ) ;
oFCKeditor.setWidth("600");
oFCKeditor.setHeight("480");
oFCKeditor.setValue( "input" );
out.println( oFCKeditor.create() ) ;
%>
<input type="submit" value="Submit">
</form>
<br> <br><br>
方法三:
<script type="text/javascript" src="fckeditor/fckeditor.js"></script>
<form action="show.jsp" method="post" target="_blank">
<table border="0" width="700"><tr><td>
<textarea id="content" name="content" style="WIDTH: 100%; HEIGHT: 400px">
input</textarea>
<script type="text/javascript">
var oFCKeditor = new FCKeditor('content');
oFCKeditor.BasePath = "/db/fckeditor/" ;
oFCKeditor.Height = 400;
oFCKeditor.Width=600;
oFCKeditor.ToolbarSet = "Default" ;
oFCKeditor.ReplaceTextarea();
</script>
<input type="submit" value="Submit">
</td></tr></table>
</form>
</body>
</html>
web.xml ---------------------------- -------------------其它说明
<web-app>
<servlet>
<servlet-name>Connector</servlet-name>
<servlet-class>com.fredck.FCKeditor.connector.ConnectorServlet</servlet-class>
<init-param>
<param-name>baseDir</param-name>
将在FCKeditor/editor/下创建Image和Flash文件夹,用于存放上传文件
<param-value>/editor/</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>false</param-value>调试时设为true
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>SimpleUploader</servlet-name>
<servlet-class>com.fredck.FCKeditor.uploader.SimpleUploaderServlet</servlet-class>
<init-param>
<param-name>baseDir</param-name>
将在FCKeditor/editor/下创建Image和Flash文件夹,用于存放上传文件
<param-value>/editor/</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>true</param-value>调试时设为true
</init-param>
<init-param>
<param-name>enabled</param-name>
<param-value>true</param-value>修改成true
</init-param>
<init-param>
<param-name>AllowedExtensionsFile</param-name>
<param-value></param-value>
</init-param>
<init-param>
<param-name>DeniedExtensionsFile</param-name>
<param-value>php|php3|php5|phtml|asp|aspx|ascx|jsp|cfm|cfc|pl|bat|exe|dll|reg|cgi</param-value>
</init-param>
<init-param>
<param-name>AllowedExtensionsImage</param-name>
<param-value>jpg|gif|jpeg|png|bmp</param-value>
</init-param>
<init-param>
<param-name>DeniedExtensionsImage</param-name>
<param-value></param-value>
</init-param>
<init-param>
<param-name>AllowedExtensionsFlash</param-name>
<param-value>swf|fla</param-value>
</init-param>
<init-param>
<param-name>DeniedExtensionsFlash</param-name>
<param-value></param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Connector</servlet-name>
和fckconfig.js的ImageBrowserURL等对应
<url-pattern>/editor/filemanager/browser/default/connectors/jsp/connector</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>SimpleUploader</servlet-name>
这里你可以按自己应用具体配置,需要和fckconfig.js的ImageUploadUrl等对应
<url-pattern>/editor/upload.do</url-pattern>
</servlet-mapping>
</web-app>