1 首先在这里下载fckeditor组件 放在自己的工程中,fckconfig.js需要配置自己项目的处理上传路径这个项目中是/rhcy/connector,可以查找在那个位置,然后在web.xml中找到connector所对应的servlet,
2,在页面中引入该fckeditor工具 ???<script type="text/javascript"
???src="<%=path%>/flexigrid_my/jquery-1.3.2.min.js"></script>
??????? <script type="text/javascript" src="/rhcy/fckeditor/fckeditor.js"></script>
?
获得编辑器的代码为
?
?<form action="" method="post">
??????????? <table border="0" width="700" align="center">
??????????????? <tr>
??????????????????? <td>
??????????????????????? <textarea id="text1" name="content"
??????????????????????????? style="WIDTH: 80%; HEIGHT: 400px">放假</textarea>
??????????????????????? <script type="text/javascript">
??????????????????????????? var oFCKeditor = new FCKeditor('content') ;
??????????????????????????? oFCKeditor.BasePath = "/rhcy/fckeditor/" ;这里改为自己的项目
??????????????????????????? oFCKeditor.Height = 400;
??????????????????????????? oFCKeditor.Width = 800;
??????????????????????????? oFCKeditor.ToolbarSet = "Default" ;
??????????????????????????? oFCKeditor.ReplaceTextarea();
??????????????????????? </script>
??????????????????????
??????????????????? </td>
??????????????? </tr>
??????????? </table>
??????? </form>
?
压缩包中的两个servlet的配置如下
第一个配置是fckeditor上传组件的配置
<servlet>
??<servlet-name>SimpleUploader</servlet-name>
??<servlet-class>com.fredck.FCKeditor.uploader.SimpleUploaderServlet</servlet-class>
??<init-param>
???<param-name>baseDir</param-name>
???<param-value>/UserFiles/</param-value>
??</init-param>
??<init-param>
???<param-name>debug</param-name>
???<param-value>true</param-value>
??</init-param>
??<init-param>
???<param-name>enabled</param-name>
???<param-value>true</param-value>
??</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>SimpleUploader</servlet-name>
??? <url-pattern>/simpleuploader</url-pattern>
? </servlet-mapping>
?
<servlet>
??<servlet-name>Connector</servlet-name>
??<servlet-class>com.fredck.FCKeditor.connector.ConnectorServlet</servlet-class>
??<init-param>
???<param-name>baseDir</param-name>
???<param-value>/UserFiles/</param-value>
??</init-param>
??<init-param>
???<param-name>debug</param-name>
???<param-value>true</param-value>
??</init-param>
??<load-on-startup>1</load-on-startup>
?</servlet>
?
?
? <servlet-mapping>
??? <servlet-name>Connector</servlet-name>
??? <url-pattern>/connector</url-pattern>
? </servlet-mapping>
?
?
这两映射路径都要在fckconfig.js中进行更改
下面几项路径必须要修改我现在项目是rhcy你可以改为自己的
?
FCKConfig.LinkBrowser = true ;
FCKConfig.LinkBrowserURL = FCKConfig.BasePath + 'filemanager/browser/default/browser.html?Connector=/rhcy/connector';
FCKConfig.LinkBrowserWindowWidth?= FCKConfig.ScreenWidth * 0.7 ;??// 70%
FCKConfig.LinkBrowserWindowHeight?= FCKConfig.ScreenHeight * 0.7 ;?// 70%
FCKConfig.ImageBrowser = true ;
FCKConfig.ImageBrowserURL = FCKConfig.BasePath + 'filemanager/browser/default/browser.html?Type=Image&Connector=/rhcy/connector'
FCKConfig.ImageBrowserWindowWidth? = FCKConfig.ScreenWidth * 0.7 ;?// 70% ;
FCKConfig.ImageBrowserWindowHeight = FCKConfig.ScreenHeight * 0.7 ;?// 70% ;
FCKConfig.FlashBrowser = true ;
FCKConfig.FlashBrowserURL = FCKConfig.BasePath + 'filemanager/browser/default/browser.html?Type=Flash&Connector=/rhcy/connector';
FCKConfig.FlashBrowserWindowWidth? = FCKConfig.ScreenWidth * 0.7 ;?//70% ;
FCKConfig.FlashBrowserWindowHeight = FCKConfig.ScreenHeight * 0.7 ;?//70% ;
FCKConfig.LinkUpload = true ;
FCKConfig.LinkUploadURL = FCKConfig.BasePath + '/simpleuploader?Type=File';
FCKConfig.LinkUploadAllowedExtensions?= ".(7z|aiff|asf|avi|bmp|csv|doc|fla|flv|gif|gz|gzip|jpeg|jpg|mid|mov|mp3|mp4|mpc|mpeg|mpg|ods|odt|pdf|png|ppt|pxd|qt|ram|rar|rm|rmi|rmvb|rtf|sdc|sitd|swf|sxc|sxw|tar|tgz|tif|tiff|txt|vsd|wav|wma|wmv|xls|xml|zip)$" ;???// empty for all
FCKConfig.LinkUploadDeniedExtensions?= "" ;?// empty for no one
FCKConfig.ImageUpload = true ;
FCKConfig.ImageUploadURL = FCKConfig.BasePath + '/simpleuploader?Type=Image';
FCKConfig.ImageUploadAllowedExtensions?= ".(jpg|gif|jpeg|png|bmp)$" ;??// empty for all
FCKConfig.ImageUploadDeniedExtensions?= "" ;???????// empty for no one
FCKConfig.FlashUpload = true ;
FCKConfig.FlashUploadURL = FCKConfig.BasePath + '/fckeditor/simpleuploader?Type=Flash';
FCKConfig.FlashUploadAllowedExtensions?= ".(swf|flv)$" ;??// empty for all
FCKConfig.FlashUploadDeniedExtensions?= "" ;?????// empty for no one
?
?
完了把我这个压缩包的文件拔下去看看就明白了