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();

}
}]
});
...全文
123 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
哦呦喂 2011-04-28
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 licip 的回复:]
你没有对应属性的get方法与set方法。
[/Quote]对哪个属性get和set
licip 2011-04-28
  • 打赏
  • 举报
回复
你没有对应属性的get方法与set方法。
哦呦喂 2011-04-28
  • 打赏
  • 举报
回复
有没有高手在,帮忙解决一下
哦呦喂 2011-04-28
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 jumpheightway 的回复:]
不知道楼主的这个dwbmda是个什么东东
[/Quote]
这个是个实体类的名字!
jumpheightway 2011-04-28
  • 打赏
  • 举报
回复
不知道楼主的这个dwbmda是个什么东东

52,797

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 Ajax
社区管理员
  • Ajax
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧