📄 complaintlevaction.java
字号:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.csu.crm.base.action;
import java.lang.reflect.InvocationTargetException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.csu.crm.base.form.ComplaintLevForm;
import com.csu.crm.common.dao.original.CrmComplaintLevDAO;
import com.csu.crm.common.vo.CrmComplaintLev;
import com.csu.crm.util.BeanUtil;
/**
*
* @author 3eCRM小组:曾东
* @since Oct 2, 2007 4:08:41 PM
* @version 1.0 创建时间:Oct 2, 2007 4:08:41 PM,初始版本
*/
public class ComplaintLevAction extends Action {
private static final Log log = LogFactory.getLog(ComplaintLevAction.class);
private CrmComplaintLevDAO crmComplaintLevDAO;
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
ComplaintLevForm complaintLevForm = (ComplaintLevForm) form;
log.warn("进入ComplaintLevAction类的execute方法");
log.warn("得到complaintLevForm表单数据");
log.warn(complaintLevForm.toString());
CrmComplaintLev crmComplaintLev;
//判断提交方法是 增加 还是 修改
if(request.getSession().getAttribute("selectedComplaintLev") == null) {
//增加
crmComplaintLev = new CrmComplaintLev();
try {
BeanUtils.populate(crmComplaintLev,BeanUtils.describe(complaintLevForm));
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
crmComplaintLevDAO.save(crmComplaintLev);
} else {
//修改
crmComplaintLev = (CrmComplaintLev)request.getSession().getAttribute("selectedComplaintLev");
try {
BeanUtils.populate(crmComplaintLev,BeanUtils.describe(complaintLevForm));
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
crmComplaintLevDAO.merge(crmComplaintLev);
}
log.warn("提交成功");
return null;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -