meihua212 2009-03-10 22:18
浏览 175
已采纳

struts2交互EXTjs

function getUpdateForm() {
win.title = '修改考勤信息';
if(!form){
form = new Ext.FormPanel({
labelWidth : 75,
//url :'UpdateEmployee.action',
frame : true,
bodyStyle : 'padding:5px 5px 0',
width : 340,
defaults : {
width : 230
},
defaultType : 'textfield',
standardSubmit : true,
items : [{
fieldLabel : 'id',
name : 'employee_id',
readOnly : true
}, {
fieldLabel : '姓名',
name:'name',
allowBlank : false
}, {

fieldLabel : '业务室',
name : 'department'
}, {
fieldLabel : '上午',
name : 'morning'
}, {
fieldLabel : '下午',
name : 'afternoon'
}, {
fieldLabel : '日期',
name : 'datenote'
}, {
fieldLabel : '备注',
name : 'note'
}],
buttons : [{
text : '保存',
// formBind : true,
type : 'submit',
// 定义表单提交事件
handler : function() {
if (form.form.isValid()) {// 验证合法后使用加载进度条
// 提交到服务器操作
form.form.doAction('submit', {
url : '../UpdateEmployee.action',// 文件路径
method : 'post',// 提交方法post或get
params : '',
// 提交成功的回调函数
failure : function(retForm, retAction) {
if (retAction.result && retAction.result == '1') {
Ext.MessageBox.alert('提示', '保存数据成功!');
win.hide();
/* var totalCount = ptb.store.getTotalCount();
var pageSize = ptb.pageSize;
var div = parseInt(totalCount / pageSize);
var mol = totalCount % pageSize;
ptb.cursor = div * pageSize;*/
ds.load({
params : {
start : 0,
limit : 10
}
});

} else if (retAction.result
&& retAction.result == 'error') {
Ext.MessageBox.alert('提示', '保存数据失败!');
} else {
Ext.Msg.alert('错误', '服务器出现错误请稍后再试!');
}
},
waitMsg : '保存数据...'
});
}
}
}, {
text : '取消',
handler : function() {
form.form.reset();
}// 重置表单
}]
});
}
return form;
//////////////////////////////
public String UpdateEmployee() {
//System.out.println(this.employee.getEmployee_id() + "---" + this.employee.getName() + "---");
this.setJsonString("{success:true}");
System.out.println(this.getJsonString());
try {
this.getEmployeeService().updateEmployee(this.getEmployee());
} catch (Exception e) {
e.printStackTrace();
}
return SUCCESS;
}
///////////////////////////////////////
怎么是总是这个错误呢?attempt to create saveOrUpdate event with null entity 不是struts2可以对象传递吗?

  • 写回答

1条回答 默认 最新

  • 马勒格彼得 2009-03-11 16:30
    关注

    你的实例是空的,你DBU一下,你是不是没配置formpanel的name属性

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 路易威登官网 里边的参数逆向
  • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
  • ¥50 需求一个up主付费课程
  • ¥20 模型在y分布之外的数据上预测能力不好如何解决
  • ¥15 processing提取音乐节奏
  • ¥15 gg加速器加速游戏时,提示不是x86架构
  • ¥15 python按要求编写程序
  • ¥15 Python输入字符串转化为列表排序具体见图,严格按照输入
  • ¥20 XP系统在重新启动后进不去桌面,一直黑屏。
  • ¥15 opencv图像处理,需要四个处理结果图