在Servlet中能接收到Ext上传域的文件,但是接收不到一同提交上来的其他表单数据
问题如题目描述,请兄弟们帮忙看看,代码如下:
Ext:
Ext.onReady(function(){
var simple = new Ext.form.FormPanel({
labelWidth: 75,
frame:true,
title: '外部输入导入',
bodyStyle:'padding:5px 5px 0',
width: 800,
defaults: {width: 230},
fileUpload:true,
xtype:'textfield',
defaultType: 'textfield',
items: [{
fieldLabel: '报表类型',
name: 'modelType',
hiddenName: 'modelValue',
xtype: 'combo',
store: new Ext.data.SimpleStore({
fields: ['value','text'],
data: [['5','市场部'],['10','营销热点'],['20','CDMA'],['30','品牌客户'],['40','增值业务']]
}),
emptyText: '请选择',
mode: 'local',
triggerAction: 'all',
valueField: 'value',
displayField: 'text',
readOnly: true
},{
fieldLabel: '学号',
name: 'test'
},{
fieldLabel: '文件选择',
name: 'filePath',
inputType:'file'
}
],
buttons: [{
id:'bt_save',
text: '导入',
handler:function(){
simple.getForm().submit({
method:'POST',
waitMsg:'正在导入,请等待...',
url:'ExportDataServlet.do',
success:function(form,action){
Ext.Msg.hide();
Ext.Msg.alert('提示信息',"成功导入!");
},
failure:function(form,action){
Ext.Msg.hide();
Ext.Msg.alert('提示信息',"导入格式不正确,如果你是使用Excel2003以后的版本,请先转换成2003版本格式!");
},
scope:this
});
}
},{
text: '取消'
}]
});
simple.render(document.body);
});
Servlet片段:
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//取得当前路径
response.setContentType("text/html");
PrintWriter out = response.getWriter();
String webpath = this.getServletContext().getRealPath("/");
String modelValue = request.getParameter("modelValue");
.......
}
接不到modelValue 的值,为什么呢?
------解决方案--------------------
JScript code
waitMsg:'正在导入,请等待...',
url:'ExportDataServlet.do',
params : "modelValue=" + Ext.getCmp('modelValue').value()