页面用的是ext4,form表单中的数据如何在struts2中的action接收form表单中的数据,form表单提交的方式是标准的post提交,后台我测试了半天总是为null贴上代码var form = Ext.create('Ext.form.Panel',{
// The fields
bodyPadding: 5,
id:'form',
// standardSubmit:true,
bodyPadding: '10 10 0',
height:320,
defaults: {
anchor: '100%',
allowBlank: false,
labelWidth: 60
},
items: [
{
xtype: 'textfield',
blankText :'名称不能为空!',
fieldLabel: '名称',
name: 'floorName',
allowBlank: false
},{
xtype: 'textfield',
blankText :'ip地址不能为空!',
fieldLabel: 'IP地址',
name: 'ip',
allowBlank: false
},{
xtype: 'textfield',
blankText :'总线编号不能为空!',
fieldLabel: '总线编号',
name: 'can',
allowBlank: false
},{
xtype: 'textfield',
blankText :'比例不能为空!',
fieldLabel: '比例尺',
name: 'scale',
allowBlank: false
},{
fieldLabel: '地图',
blankText :'地图不能为空!',
xtype:'filefield',
name: 'file',
anchor: '100%',
labelWidth: 60,
allowBlank: false
},{
xtype: 'textarea',
height:120,
fieldLabel: '描述',
name: 'desc'
}],
buttons: [{
text: '重置',
handler: function() {
this.up('form').getForm().reset();
}
}, {
text: '提交',
formBind: true, //only enabled once the form is valid
handler: function() {
var form = this.up('form').getForm();
if (form.isValid()) {
form.submit({
url: 'addFloor.action?building='+floorId,
mthod:'post',
waitMsg: '正在上传文件请稍后......',
success: function(form, action) {
Ext.Msg.alert('Success', '保存成功!');
Ext.getCmp("tree").getLoader().load();
Ext.getCmp("tree").expand(true);
},
failure: function(form, action) {
Ext.Msg.alert('Failed', '保存失败');
}
});
}
}
}]
})
后台actionpublic class LocateFloorExtAction extends BaseAction {
String floorName;//楼层名称
String ip;//ip地址
String can;//总线编号
File file;//地图
String desc;//描述
String scale;//比例尺
String building;//楼层id
ILocateBuildingService buildingService;
ILocateFloorService service;
别的我就不发了,能进去,执行方法后获取的总是空的,请高手帮忙看下要怎么解决啊。
// The fields
bodyPadding: 5,
id:'form',
// standardSubmit:true,
bodyPadding: '10 10 0',
height:320,
defaults: {
anchor: '100%',
allowBlank: false,
labelWidth: 60
},
items: [
{
xtype: 'textfield',
blankText :'名称不能为空!',
fieldLabel: '名称',
name: 'floorName',
allowBlank: false
},{
xtype: 'textfield',
blankText :'ip地址不能为空!',
fieldLabel: 'IP地址',
name: 'ip',
allowBlank: false
},{
xtype: 'textfield',
blankText :'总线编号不能为空!',
fieldLabel: '总线编号',
name: 'can',
allowBlank: false
},{
xtype: 'textfield',
blankText :'比例不能为空!',
fieldLabel: '比例尺',
name: 'scale',
allowBlank: false
},{
fieldLabel: '地图',
blankText :'地图不能为空!',
xtype:'filefield',
name: 'file',
anchor: '100%',
labelWidth: 60,
allowBlank: false
},{
xtype: 'textarea',
height:120,
fieldLabel: '描述',
name: 'desc'
}],
buttons: [{
text: '重置',
handler: function() {
this.up('form').getForm().reset();
}
}, {
text: '提交',
formBind: true, //only enabled once the form is valid
handler: function() {
var form = this.up('form').getForm();
if (form.isValid()) {
form.submit({
url: 'addFloor.action?building='+floorId,
mthod:'post',
waitMsg: '正在上传文件请稍后......',
success: function(form, action) {
Ext.Msg.alert('Success', '保存成功!');
Ext.getCmp("tree").getLoader().load();
Ext.getCmp("tree").expand(true);
},
failure: function(form, action) {
Ext.Msg.alert('Failed', '保存失败');
}
});
}
}
}]
})
后台actionpublic class LocateFloorExtAction extends BaseAction {
String floorName;//楼层名称
String ip;//ip地址
String can;//总线编号
File file;//地图
String desc;//描述
String scale;//比例尺
String building;//楼层id
ILocateBuildingService buildingService;
ILocateFloorService service;
别的我就不发了,能进去,执行方法后获取的总是空的,请高手帮忙看下要怎么解决啊。
中的method少写了个字母吧???