页面中
<input type="radio" id="isSend" name="graduationCertificate.isSend" checked="checked" value="1">已发放
function saveCertificate(){
var state = $("#certificateForm").validate().form();//ajax 提交的验证
if(!state){
return;
}
$.ajax({
type: "POST",
url:'<%=path%>/graduationcertificate/graduationcertificate!saveOrUpdateCertificate.action',
data:$('#certificateForm').serialize(),
async: false,
dataType:"html",
success: function(data) {
if(data == ""){
closeWin();
addCertificate();
$.ligerDialog.alert('保存成功!', '信息', 'success');
loadGrid(true);
}else{
$.ligerDialog.alert(data, '信息', 'error');
}
},
error: function(request) {
$.ligerDialog.alert('系统出错误!', '信息', 'error');
}
});
}
action中则提供对象的get和set方法即可:
/**
* @return graduationCertificate
*/
public GraduationCertificate getGraduationCertificate() {
return graduationCertificate;
}
/**
* @param graduationCertificate 要设置的 graduationCertificate
*/
public void setGraduationCertificate(GraduationCertificate graduationCertificate) {
this.graduationCertificate = graduationCertificate;
}
public void saveOrUpdateCertificate() throws Exception{ //此方法中直接调用即可
if(null != graduationCertificate){
Integer userId = (Integer) session.get(SessionFinalVariable.USER_ID);
SysUserInfo createUser = userDao.get(userId);
graduationCertificate.setCreateUser(createUser);
graduationCertificate.setCreateDate(new Date());
}
String msg = graduationCertificateService.saveOrUpdateGraduationCertificate(graduationCertificate);
responseInfo(msg);
}