struts2实体类获取不到Ext.FormPanel提交的值
哦呦喂 2011-04-28 12:22:17 后台报错:org.springframework.dao.DataIntegrityViolationException: not-null property references a null or transient value: com.test.bean.TDjDwbmda.xzqhdm; nested exception is org.hibernate.PropertyValueException: not-null property references a null or transient value: com.test.bean.TDjDwbmda.xzqhdm
Caused by: org.hibernate.PropertyValueException: not-null property references a null or transient value: com.test.bean.TDjDwbmda.xzqhdm
action方法:
public String saveBean(){
try {
this.dwbmdaService.saveBean(dwbmda);
System.out.println("=================================="+this.getDwbmda());
System.out.print("+++++++++++++++++++++++++++++++++++"+this.getDwbmdaService());
} catch (Exception e) {
e.printStackTrace();
}
return SUCCESS;
}
struts配置文件:<action name="AddDwbmda" class="dwbmdaDaoAction" method="saveBean">
<result>/resource/json_struts2.jsp</result>
</action>
js页面代码:dwbmda.wins = new Ext.Window({
title : "登录",
width : 500,
height : 400,
// layout : "form",
modal : true,
labelWidth : 45,
resizable : false,
animCollapse : true,
plain : true,
autoDestroy : false,
bodyStyle : "padding:3px",
constrain : true,
items : dwbmda.DwbmdaFrom = new Ext.FormPanel({
bodyStyle : 'padding:5px',
items : [{
xtype : 'fieldset',
title : ' 登陆人员基本信息 ',
layout : 'column',
border : true,
items : [{
columnWidth : .5,
layout : 'form',
border : false,
items : [{
xtype : 'textfield',
fieldLabel : '村名编码',
name : 'cmbm',
id : 'cmbm',
anchor : '95%'
}, {
xtype : 'textfield',
fieldLabel : '行政区划',
name : 'xzqhdm',
id : 'xzqhdm',
anchor : '95%'
}, {
xtype : 'textfield',
fieldLabel : '补免种类',
name : 'bmzl',
id : 'bmzl',
anchor : '95%'
}, {
xtype : 'textfield',
fieldLabel : '生产厂家',
name : 'sccj',
id : 'sccj',
anchor : '95%'
}, {
xtype : 'datefield',
fieldLabel : '录入时间',
name : 'lrsj',
id : 'lrsj',
anchor : '95%'
}]
}, {
columnWidth : .5,
layout : 'form',
border : false,
items : [{
xtype : 'textfield',
fieldLabel : '补免畜禽种类',
name : 'bmxqid',
id : 'bmxqid',
anchor : '95%'
}, {
xtype : 'textfield',
fieldLabel : '疫病种类',
name : 'ymzlid',
id : 'ymzlid',
anchor : '95%'
}, {
xtype : 'textfield',
fieldLabel : '疫苗批号',
name : 'ymph',
id : 'ymph',
anchor : '95%'
}, {
xtype : 'textfield',
fieldLabel : '免疫人员',
name : 'myry',
id : 'myry',
anchor : '95%'
}, {
xtype : 'textfield',
fieldLabel : '录入人员',
id : 'lrry',
name : 'lrry',
anchor : '95%'
}]
}]
}]
}),
buttons : [{
iconCls : 'btn-save',
text : '保存',
handler : function() {
if (dwbmda.DwbmdaFrom.getForm().isValid()) {
Ext.MessageBox.confirm('确认', '确定要保存吗?', function(btn) {
if (btn == 'yes') {
dwbmda.DwbmdaFrom.getForm().submit({
url : 'AddDwbmda.action',
method:'post',
// params : {
// cmbm : Ext.getCmp("cmbm").getValue(),
// xzqhdm : Ext.getCmp("xzqhdm").getValue(),
// ymzlid : Ext.getCmp("ymzlid").getValue(),
// bmxqid : Ext.getCmp("bmxqid").getValue(),
// bmzl : Ext.getCmp("bmzl").getValue(),
// ymph : Ext.getCmp("ymph").getValue(),
// sccj : Ext.getCmp("sccj").getValue(),
// myry : Ext.getCmp("myry").getValue(),
// lrry : Ext.getCmp("lrry").getValue(),
// lrsj : Ext.getCmp("lrsj").getValue()
//
// },
success : function(form, action) {
Ext.MessageBox.show({
title : '提示信息',
msg : '操作成功!',
buttons : Ext.MessageBox.OK,
icon : Ext.MessageBox.INFO
});
dwbmda.wins.hide();
},
failure : function() {
Ext.MessageBox.show({
title : '提示信息',
msg : '抱歉!您的操作失败!',
buttons : Ext.MessageBox.OK,
icon : Ext.MessageBox.WARNING
});
},
waitMsg : "保存数据中, 请稍候...",
waitTitle : "保存查询定义树"
});
}
});
}
}
}, {
iconCls : 'btn-undo',
text : '取消',
handler : function() {
dwbmda.wins.hide();
}
}]
});