📄 cstcustomeraction.java
字号:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package org.jb.y2t308.team3.web.action;
import java.io.IOException;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.jb.common.web.action.BaseAction;
import org.jb.y2t308.team3.biz.CstCustomerBiz;
import org.jb.y2t308.team3.entity.CstCustomer;
import org.jb.y2t308.team3.web.form.CstCustomerForm;
/**
* MyEclipse Struts Creation date: 02-11-2009
*
* XDoclet definition:
*
* @struts.action path="/cstCustomerAction" name="cstCustomerForm"
* parameter="oper" scope="request"
* @struts.action-forward name="succe" path="/WEB-INF/jsp/~cust/cust/list.jsp"
*/
public class CstCustomerAction extends BaseAction {
/*
* Generated Methods
*/
/**
* Method execute
*
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
private CstCustomerBiz cstCustomerBiz = null;
// 得到客户列表
public ActionForward toList(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
CstCustomerForm cstCustomerForm = (CstCustomerForm) form;// TODO
this.cstCustomerBiz.getList(cstCustomerForm.getItem(), cstCustomerForm
.getPageResult());
return mapping.findForward("list");
}
// 在客户管理列表页面中点击 编辑 跳转到 编辑页面
public ActionForward toEdit(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
String custNo = request.getParameter("custNo");
CstCustomer customer = cstCustomerBiz.get(custNo.trim());
request.setAttribute("customer", customer);
return mapping.findForward("edit");
}
// 在客户管理列表页面中点击 编辑 编辑成功后点击保存 保存成功后 到 列表页面
public ActionForward doEdit(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
CstCustomerForm cstCustomerForm = (CstCustomerForm) form;// TODO
String custNo = request.getParameter("custNo"); // 得到从页面传来的客户编号
CstCustomer customer = cstCustomerForm.getItem();
customer.setCustNo(custNo);
//this.cstCustomerBiz.update(customer);
this.cstCustomerBiz.update(cstCustomerForm.getItem());
try {
response.sendRedirect("cstCustomer.do?oper=toList"); // 编辑成功后跳转到客户管理列表
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
// 在客户管理列表页面中点击 删除 删除信息
public ActionForward doDelete(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
String custNo = request.getParameter("custNo");
this.cstCustomerBiz.delete(custNo);
try {
response.sendRedirect("cstCustomer.do?oper=toList");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
/**
* @return the cstCustomerBiz
*/
public CstCustomerBiz getCstCustomerBiz() {
return cstCustomerBiz;
}
/**
* @param cstCustomerBiz
* the cstCustomerBiz to set
*/
public void setCstCustomerBiz(CstCustomerBiz cstCustomerBiz) {
this.cstCustomerBiz = cstCustomerBiz;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -