📄 linkmanaction.java
字号:
package org.jb.y272.team0.web.action;
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.y272.team0.biz.CustomerBiz;
import org.jb.y272.team0.biz.LinkmanBiz;
import org.jb.y272.team0.entity.CstCustomer;
import org.jb.y272.team0.entity.CstLinkman;
import org.jb.y272.team0.web.form.LinkmanForm;
/**
* 联系人 Action Bean
* @author hailong.liu
*/
public class LinkmanAction extends BaseAction {
/**
* 转到 查询页面
*/
public ActionForward toList(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception{
LinkmanForm myForm = (LinkmanForm)form;
String id = request.getParameter("id");
CstCustomer cust = this.customerBiz.getWithLinkmans(id);
myForm.setCust(cust);
return mapping.findForward("list");
}
/**
* 转到 新建页面
*/
public ActionForward toAdd(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception{
LinkmanForm myForm = (LinkmanForm)form;
myForm.setItem(new CstLinkman());
myForm.getItem().setLkmSex("男");
return mapping.findForward("add");
}
/**
* 执行 新建操作
*/
public ActionForward doAdd(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception{
LinkmanForm myForm = (LinkmanForm)form;
this.linkmanBiz.add(myForm.getItem());
String id = request.getParameter("item.cstCustomer.custNo");
response.sendRedirect("linkman.do?o=toList&id="+id);
return null;
}
/**
* 转到 编辑页面
*/
public ActionForward toEdit(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception{
LinkmanForm myForm = (LinkmanForm)form;
String id = request.getParameter("lid");
CstLinkman item = this.linkmanBiz.get(Long.parseLong(id));
myForm.setItem(item);
return mapping.findForward("edit");
}
/**
* 执行 编辑操作
*/
public ActionForward doEdit(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception{
LinkmanForm myForm = (LinkmanForm)form;
this.linkmanBiz.update(myForm.getItem());
String id = request.getParameter("item.cstCustomer.custNo");
response.sendRedirect("linkman.do?o=toList&id="+id);
return null;
}
/**
* 执行 删除操作
*/
public ActionForward doDel(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception{
String id = request.getParameter("id");
String lid = request.getParameter("lid");
this.linkmanBiz.del(Long.parseLong(lid));
response.sendRedirect("linkman.do?o=toList&id="+id);
return null;
}
/**
* 转到 明细页面
*/
public ActionForward doDetail(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception{
LinkmanForm myForm = (LinkmanForm)form;
String id = request.getParameter("id");
CstLinkman item = this.linkmanBiz.get(Long.parseLong(id));
myForm.setItem(item);
return mapping.findForward("detail");
}
/* 注入Biz方法 */
private LinkmanBiz linkmanBiz = null;
public void setLinkmanBiz(LinkmanBiz linkmanBiz){
this.linkmanBiz = linkmanBiz;
}
private CustomerBiz customerBiz = null;
public void setCustomerBiz(CustomerBiz customerBiz){
this.customerBiz = customerBiz;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -