?? planaction.java
字號(hào):
?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.ChanceBiz;
import org.jb.y272.team0.biz.PlanBiz;
import org.jb.y272.team0.entity.SalChance;
import org.jb.y272.team0.web.form.PlanForm;
/**
* Action Bean
* @author hailong.liu
*/
public class PlanAction extends BaseAction {
/**
* 制定計(jì)劃
*/
public ActionForward toMake(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception{
PlanForm myForm = (PlanForm)form;
String id = request.getParameter("id");
SalChance item = this.chanceBiz.getWithPlans(Long.parseLong(id));
myForm.setChance(item);
return mapping.findForward("make");
}
/**
* 執(zhí)行計(jì)劃
*/
public ActionForward toExec(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception{
PlanForm myForm = (PlanForm)form;
String id = request.getParameter("id");
SalChance item = this.chanceBiz.getWithPlans(Long.parseLong(id));
myForm.setChance(item);
return mapping.findForward("exec");
}
public ActionForward doExec(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception{
PlanForm myForm = (PlanForm)form;
this.planBiz.exec(myForm.getItem());
String id = request.getParameter("id");
response.sendRedirect("plan.do?o=toExec&id="+id);
return null;
}
/**
* 開(kāi)發(fā)成功
*/
public ActionForward doSuc(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception{
String id = request.getParameter("id");
this.chanceBiz.succes(Long.parseLong(id));
response.sendRedirect("plan.do?o=toList");
return null;
}
/**
* 開(kāi)發(fā)失敗
*/
public ActionForward doFail(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception{
String id = request.getParameter("id");
this.chanceBiz.fail(Long.parseLong(id));
response.sendRedirect("plan.do?o=toList");
return null;
}
/**
* 轉(zhuǎn)到 查詢(xún)頁(yè)面
*/
public ActionForward toList(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception{
PlanForm myForm = (PlanForm)form;
myForm.getChance().setChcStatus("非新建");
this.chanceBiz.search(myForm.getChance(), myForm.getPageResult());
return mapping.findForward("list");
}
/**
* 執(zhí)行 新建操作
*/
public ActionForward doAdd(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception{
PlanForm myForm = (PlanForm)form;
this.planBiz.add(myForm.getItem());
String id = request.getParameter("id");
response.sendRedirect("plan.do?o=toMake&id="+id);
return null;
}
/**
* 執(zhí)行 編輯操作
*/
public ActionForward doEdit(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception{
PlanForm myForm = (PlanForm)form;
this.planBiz.update(myForm.getItem());
String id = request.getParameter("id");
response.sendRedirect("plan.do?o=toMake&id="+id);
return null;
}
/**
* 執(zhí)行 刪除操作
*/
public ActionForward doDel(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception{
String pid = request.getParameter("pid");
this.planBiz.del(Long.parseLong(pid));
String id = request.getParameter("id");
response.sendRedirect("plan.do?o=toMake&id="+id);
return null;
}
/**
* 轉(zhuǎn)到 明細(xì)頁(yè)面
*/
public ActionForward doDetail(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception{
PlanForm myForm = (PlanForm)form;
String id = request.getParameter("id");
SalChance item = this.chanceBiz.getWithPlans(Long.parseLong(id));
myForm.setChance(item);
return mapping.findForward("detail");
}
/* 注入Biz方法 */
private PlanBiz planBiz = null;
public void setPlanBiz(PlanBiz planBiz){
this.planBiz = planBiz;
}
private ChanceBiz chanceBiz = null;
public void setChanceBiz(ChanceBiz chanceBiz){
this.chanceBiz = chanceBiz;
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -