EXT 上传文件时加上fileUpload: true出错的问题。
来源:互联网 发布:苏州谢谢网络 编辑:程序博客网 时间:2024/05/23 17:49
Ext做文件上传的时候发现,如果上传成功后从后台取返回信息,出现错误。
- var importForm = new Ext.FormPanel({
- labelAlign:'right',
- buttonAlign:'right',
- frame:true,
- title: '',
- bodyStyle:'padding:5px 5px',
- width:450,
- url:'importAction.do?method=importAlarmRule',
- fileUpload: true,
- items: [{
- xtype: 'textfield',
- fieldLabel: '<bean:message key="aloes.message.resource.import.file" />',
- name: 'importFile',
- width: 270,
- height:20,
- allowBlank:false,
- blankText: '<bean:message key="aloes.message.resource.import.file.select" />',
- inputType: 'file'//文件类型
- }],
- buttons: [{
- text: '<bean:message key="button.save" />',
- handler: function() {
- importForm.getForm().submit({
- success: function(fileform, action){
- if(action.result.success == 'true'){
- Ext.Msg.alert('<bean:message key="info.header" />', '<bean:message key="aloes.message.resource.import.success" />',function(){
- importWin.close();
- });
- }else if(action.result.failure == 'formatError'){
- Ext.Msg.alert('Error', '<bean:message key="aloes.message.resource.import.failed" />'+action.result.info);
- }
- },
- failure: function(){
- Ext.Msg.alert('<bean:message key="message.error" />', '<bean:message key="aloes.message.resource.import.failed" />');
- }
- });
- }
- },{
- text: '<bean:message key="button.cancel" />',
- handler: function() {
- importWin.close();
- }
- }]
- });
- var importWin = new Ext.Window({
- id:'import-window',
- title: '<bean:message key="aloes.message.resource.import" />',
- closable:true,
- width:460,
- maximizable:false,
- modal:true,
- plain:true,
- items:[importForm]
- });
- importWin.show();
var importForm = new Ext.FormPanel({ labelAlign:'right', buttonAlign:'right', frame:true, title: '', bodyStyle:'padding:5px 5px', width:450, url:'importAction.do?method=importAlarmRule', fileUpload: true, items: [{ xtype: 'textfield', fieldLabel: '<bean:message key="aloes.message.resource.import.file" />', name: 'importFile', width: 270, height:20, allowBlank:false, blankText: '<bean:message key="aloes.message.resource.import.file.select" />', inputType: 'file'//文件类型 }], buttons: [{ text: '<bean:message key="button.save" />', handler: function() { importForm.getForm().submit({ success: function(fileform, action){ if(action.result.success == 'true'){ Ext.Msg.alert('<bean:message key="info.header" />', '<bean:message key="aloes.message.resource.import.success" />',function(){ importWin.close(); }); }else if(action.result.failure == 'formatError'){ Ext.Msg.alert('Error', '<bean:message key="aloes.message.resource.import.failed" />'+action.result.info); } }, failure: function(){ Ext.Msg.alert('<bean:message key="message.error" />', '<bean:message key="aloes.message.resource.import.failed" />'); } }); } },{ text: '<bean:message key="button.cancel" />', handler: function() { importWin.close(); } }] });var importWin = new Ext.Window({ id:'import-window', title: '<bean:message key="aloes.message.resource.import" />', closable:true, width:460, maximizable:false, modal:true, plain:true, items:[importForm] }); importWin.show();
后台的java代码往前台送数据的时候:
resultStr.append("{'failure':'false','success':'true'}");
response.setContentType(" text/html;charset=utf-8 ");
response.getWriter().print(resultStr);
contentType必须为:" text/html;charset=utf-8 "
而不能为:" text/xml;charset=utf-8 "
否则前台会报错。
- EXT 上传文件时加上fileUpload: true出错的问题。
- commons-fileupload.jar上传文件时出错
- FileUpload组件 上传不了文件的问题
- fileupload上传两个文件的问题
- 用Apache的commons-fileupload组件上传文件时,普通字段编码出错
- 使用UpdatePanel时FileUpload失效的问题!【FileUpload上传文件失败】
- FileUpload的文件上传
- commons-fileupload 文件上传问题
- .net FileUpload控件在选择文件后上传文件时 始终出现找不到文件的问题
- 关于aspnet中fileupload上传文件的问题
- 关于FileUpload文件上传的文件大小限制问题
- jsp中用fileupload组件上传文件遇到的问题
- 使用commons-fileupload.jar servlet上传文件 遇到的问题
- fileUpload上传文件的方法
- Commons-fileupload 文件的上传
- Apache的fileupload上传文件
- Web_文件的上传-FileUpload
- Ext.Net 1.x_Ext.Net.FileUpload上传文件
- contain remnants of that class,VC++中怎样彻底删除一个由ClassWizard生成的类
- 2-4 LED驱动实例
- 服务端口
- [OpenCV2]执行简单的图像算法
- 浅谈Linux下select/poll模型
- EXT 上传文件时加上fileUpload: true出错的问题。
- 二维矩阵转三元组(稀疏矩阵)
- 利用Handler定时更新Android UI
- oracle sql 性能1
- 开源Xen是如何衰落的?
- oracle sql 性能2
- 163相册验证码图片的识别手记之一 --- 去除干扰
- 两道有趣的逻辑推理题
- linux修改编码