日期:2014-05-16  浏览次数:20321 次

jsp中部署fck步骤
1、将FCKeditor文件夹拷贝到WebRoot下
    FCKeditor文件夹中包含了fck用到的js及css等

2、将FCKeditor.tld拷贝到WEB-INF下
  FCKeditor.tld的拷贝用于在jsp中引入标签

3、将所用的jar包拷贝到WEB-INF/lib中(包含了fck用到的java类、源码、上传下载用到的包)

4、修改web.xml---用于上传下载
<servlet>
	<servlet-name>Connector</servlet-name>
	<servlet-class>com.utils.fckeditor.connector.ConnectorServlet</servlet-class>
	<init-param>
		<param-name>baseDir</param-name>
		<param-value>/images/fck_img/</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>
	<servlet-name>SimpleUploader</servlet-name>
	<servlet-class>com.utils.fckeditor.uploader.SimpleUploaderServlet</servlet-class>
	<init-param>
		<param-name>baseDir</param-name>
		<param-value>/images/fck_img/</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|png</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>
  <url-pattern>/Connector</url-pattern>
</servlet-mapping>  
<servlet-mapping>
  <servlet-name>SimpleUploader</servlet-name>
  <url-pattern>/SimpleUploader</url-pattern>
</servlet-mapping>



5、将自定义的fck java类拷贝放到src下

   注意文件夹路径与web.xml对应,这两个servlet在一定程度上已经解决了fck中的bug。但上传文件名中不能包含汉字的bug仍没解决,待后续补充。

6、Jsp中引用
<%@ taglib prefix="fck" uri="/WEB-INF/FCKeditor.tld" %>
<fck:editor id="sss" width="500" height="400"> </fck:editor>
<!-- 注意fck标签有个空格 意思两标签中间必须有内容 否则不显示 -->