FCKeditor.java+Struts2的上传文件配置``

应用FCKeditor.java+Struts2的上传文件配置```

 

版本是FCKeditor_2.4.6.zip,FCKeditor.Java 2.3.zip(现在最新的FCKeditor.java已经是2.4.1了)

配置

1. 新建工程,在WebRoot文件夹下新建文件夹FCKeditor(记得大小写要一致)

2. 将FCKeditor_2.4.2包中的 editor 文件夹和fckconfig.js、fckeditor.js、fckstyles.XML、fcktemplates.xml

这四个文件放到项目中的 FCKeditor 目录。

3. 将FCKeditor.Java -2.3.zip 包中的 \web\WEB-INF\lib 下的两个 jar 文件到项目的 WebRoot\WEB-INF\lib目录下

4. 将FCKeditor.Java -2.3.zip 包中的 \src 下的 FCKeditor.tld 文件到项目的 WebRoot\WEB-INF 目录

5. 在 WebRoot 目录下新建 UploadFile文件夹(这个文件夹的名字要和web.xml中配置的basedir一致),在此文件夹下新建 Image、 Flash 、File、Media四个文件夹 ,他们分别用来存放上传的图片、动画、文件、媒体文件

6. 修改fckconfig.js组件配置文件:

 

FCKConfig.DefaultLanguage = 'zh-cn' ;
 

这个是确定你需要使用哪中语言,设定成上面的表示使用简体中文;

 

FCKConfig.LinkBrowserURL = FCKConfig.BasePath + "filemanager/browser/default/browser.Html?Connector=connectors/jsp/connector" ;
FCKConfig.ImageBrowserURL = FCKConfig.BasePath + "filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector" ;
FCKConfig.FlashBrowserURL = FCKConfig.BasePath + "filemanager/browser/default/browser.html?Type=Flash&Connector=connectors/jsp/connector" ;
 
FCKConfig.LinkUploadURL = FCKConfig.BasePath + 'filemanager/upload/simpleuploader?Type=File' ;
FCKConfig.FlashUploadURL = FCKConfig.BasePath + 'filemanager/upload/simpleuploader?Type=Flash' ;
FCKConfig.ImageUploadURL = FCKConfig.BasePath + 'filemanager/upload/simpleuploader?Type=Image' ;
 

 

更改上传文件的路径

 

7.修改web.xml

<!-- 下面是FCKEDITOR的设置 -->


	<servlet>
		<servlet-name>Connector</servlet-name>
		<servlet-class>
			com.fredck.FCKeditor.connector.ConnectorServlet
		</servlet-class>
		<init-param>
			<param-name>baseDir</param-name>
			<param-value>/UploadFile/</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.fredck.FCKeditor.uploader.SimpleUploaderServlet
		</servlet-class>
		<init-param>
			<param-name>baseDir</param-name>
			<param-value>/UploadFile/</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>Connector</servlet-name>
		<url-pattern>
			/FCKeditor/editor/filemanager/browser/default/connectors/jsp/connector
		</url-pattern>
	</servlet-mapping>

	<servlet-mapping>
		<servlet-name>SimpleUploader</servlet-name>
		<url-pattern>
			/FCKeditor/editor/filemanager/upload/simpleuploader
		</url-pattern>
	</servlet-mapping>

 

还有,记得配置struts2的过滤器为*.action

 

<filter-mapping>
		<filter-name>Struts2</filter-name>
		<url-pattern>*.action</url-pattern>
</filter-mapping>
 

你可能感兴趣的:(java,jsp,servlet,fckeditor,Flash)