java fckeditor 上传图片_java下FCKeditor上传图片问题

展开全部

先到tomcat->webapps里建立一个文件夹叫mysite。把FCKeditor里的/editor和fckconfig.js, fckeditor.js, fckstyles.xml, fcktemplates.xml四个文件copy到mysite文件夹里,因为别的文件对我32313133353236313431303231363533e58685e5aeb931333239303264们来说没有什么意义。再把FCKeditor.java 2.3中的web目录下的WEB-INF目录copy到mysite下(里面有commons-fileupload.jar, FCKeditor-2.3.jar,web.xml等几个文件), 把其中的src目录下的FCKeditor.tld文件copy到mysite/WEB-INF/下.这样它才支持JSP。

下面我们要对其中的一些文件进行修改:

打开fckconfig.js 文件,修改 FCKConfig.DefaultLanguage = ''zh-cn'' ;

把FCKConfig.LinkBrowserURL等的值替换成以下内容:

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'' ;

打开WEB-INF下面的web.xml文件:

把SimpleUploader中的配置属性enabled定义为true(开启文件上传功能)

添加标签定义:

/mysite

/WEB-INF/FCKeditor.tld

这样文件就设置完了,这时建立一个jsp文件试试:

标题:
中文信息设置

支持html(图片大小宽度不要超过170个象素)

var oFCKeditor = new FCKeditor(''content'') ;

oFCKeditor.BasePath = "/mysite/" ;

oFCKeditor.Height = 400;

oFCKeditor.ToolbarSet = "Default" ;

oFCKeditor.ReplaceTextarea();

发布时间:

加红字的部分,就是调用这个在线编辑器了。现在上传的图看一下,提示internal server error 500,还记得一开始时,我们提到的xalan.jar吗,现在把xalan.jar放到lib文件夹里,关掉tomcat再重起一下,应该好用了……

注意,如果想把这个控件融入你现有的web应用系统中,就不需要新建mysite了,你可以这样做:

1、把FCKeditor里的/editor和fckconfig.js, fckeditor.js, fckstyles.xml, fcktemplates.xml四个文件直接copy到现有web应用的某个目录下。

2、把FCKeditor.java 2.3中WEB-INF目录里的commons-fileupload.jar, FCKeditor-2.3.jar放在现有系统的lib目录下。

3、在现有系统的web.xml中加入FCKeditor.java 2.3中web.xml的配置信息,并添加标签定义:

/mysite

/WEB-INF/FCKeditor.tld

这里别忘了把SimpleUploader中的配置属性enabled定义为true以开启文件上传功能!

4、然后把FCKeditor.tld文件copy到现有系统的WEB-INF/下,这样就可以了。当然,FCKeditor.tld的位置不是绝对的,你可以放在其它地方,只要在前面的标签定义中指定相应的位置就行了。

附:FCKeditor.java中web.xml配置信息

Connector

com.fredck.FCKeditor.connector.ConnectorServlet

baseDir

/UserFiles/

debug

false

1

SimpleUploader

com.fredck.FCKeditor.uploader.SimpleUploaderServlet

baseDir

/UserFiles/

debug

false

enabled

true

AllowedExtensionsFile

DeniedExtensionsFile

php|php3|php5|phtml|asp|aspx|ascx|jsp|cfm|cfc|pl|bat|exe|dll|reg|cgi

AllowedExtensionsImage

jpg|gif|jpeg|png|bmp

DeniedExtensionsImage

AllowedExtensionsFlash

swf|fla

DeniedExtensionsFlash

2

Connector

/webapp/FCKeditor/editor/filemanager/browser/default/connectors/jsp/connector

SimpleUploader

/webapp/FCKeditor/editor/filemanager/upload/simpleuploader

/home/project/law/FCKeditor

/WEB-INF/FCKeditor.tld

本回答由网友推荐

2Q==

已赞过

已踩过<

你对这个回答的评价是?

评论

收起

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值