日期:2014-05-16 浏览次数:20452 次
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>