日期:2014-05-20  浏览次数:20835 次

急!急!急!struts2+ext文件上传出现乱码 急!急!在线等待!!!!!!!!!
使用ext+struts2做一个文件上传,但是后台接受的汉字全为?????,如果把struts.xml中<constant name="struts.i18n.encoding" value="utf-8" />的utf-8改成gbk就不出现乱码,但是其他操作则出现乱码(例如增加操作),该怎么办呢?
// 导入html信息
下面是代码 请高手赐教
function inputHtml(){

var textName=new Ext.form.TextField({
fieldLabel:'提取人姓名',
name:'name',
width :160,
id:'nameid',
allowBlank:false
});
var txtEncoding=new Ext.form.ComboBox({
fieldLabel : "编码规则",
width :160,
readOnly : true,
typeAhead : true,
allowBlank:false,
editable : false,
name : 'encoding',
// hiddenName:'encoding',//真实获取值
id:'encodingid',
mode : "local",
store : new Ext.data.SimpleStore({
fields : ["encodingvalue", "encodingtext"],
data : [["1", "gbk"], ["2", "utf-8"]]
}),
valueField : "encodingvalue",
displayField : "encodingtext",
triggerAction : "all",
selectOnFocus : true
});
var txtStateName=new Ext.form.ComboBox({
fieldLabel : "网站名称",
readOnly : true,
typeAhead : true,
editable : false,
name : 'stateName',
// hiddenName:'stateName',获取真实的值
allowBlank:false,
id:'stateNameid',
width :160,
mode : "local",
store : new Ext.data.SimpleStore({
fields : ["stateNamevalue", "stateNametext"],
data : [["1", "我爱我家"], ["2", "好租网"]]
}),
valueField : "stateNamevalue",
displayField : "stateNametext",
triggerAction : "all",
selectOnFocus : true
});
var txtDrawName=new Ext.form.ComboBox({
fieldLabel : "抽取方式",
readOnly : true,
typeAhead : true,
width :160,
editable : false,
name : 'drawOff',
// hiddenName:'drawOff',//获取真实的值
allowBlank:false,
id:'drawOffid',
mode : "local",
store : new Ext.data.SimpleStore({
fields : ["drawOffvalue", "drawOfftext"],
data : [["1", "简单信息"], ["2", "具体信息"]]
}),
valueField : "drawOffvalue",
displayField : "drawOfftext",
triggerAction : "all",
selectOnFocus : true
});
var txtResource=new Ext.form.TextField({
xtype: 'textfield',  
  fieldLabel: '文件名',  
  allowBlank:false,
  name: 'file',
  id:'fileid',
  width :200,
  inputType: 'file'// 文件类型
});
var txtDateTime=new Ext.form.DateField({
fieldLabel : "提取时间",
readOnly : true,
width :160,
allowBlank:false,
format : 'Y-m-d',
id:'dateTimeid',
name:'dateTime'

});
form6=new Ext.form.FormPanel({
frame:true,
id:'uploadForm', 
baseCls: 'x-plain', 
labelWidth: 75, 
labelAlign : 'right',
fileUpload:true, // 需上传文件
method:'POST',  
enctype:'multipart/form-data',  
items:[textName, txtEncoding,txtStateName,txtResource,txtDrawName,txtDateTime],
buttons:[{
text:"提取信息",
handler:function(){
plickUp();

}

},{
text:'重置',
handler:function(){
form6.getForm().reset();
}
}]
});
win6=new Ext.Window({
title:'导入html',
id:'inputId',
width:'400',
modal:true,
autoHeight:true,
items:[form6]

});
win6.show();


}
form6.getForm().submit( {
url : 'acquireNews.do',
method:'post',