📄 dictaction.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.DictBiz;
import org.jb.y272.team0.entity.BasDict;
import org.jb.y272.team0.web.form.DictForm;
/**
* Action Bean
* @author hailong.liu
*/
public class DictAction extends BaseAction {
/**
* 转到 查询页面
*/
public ActionForward toList(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception{
DictForm myForm = (DictForm)form;
this.dictBiz.search(myForm.getItem(), myForm.getPageResult());
return mapping.findForward("list");
}
/**
* 转到 新建页面
*/
public ActionForward toAdd(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception{
DictForm myForm = (DictForm)form;
myForm.setItem(new BasDict());
return mapping.findForward("add");
}
/**
* 执行 新建操作
*/
public ActionForward doAdd(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception{
DictForm myForm = (DictForm)form;
this.dictBiz.add(myForm.getItem());
response.sendRedirect("dict.do?o=toList");
return null;
}
/**
* 转到 编辑页面
*/
public ActionForward toEdit(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception{
DictForm myForm = (DictForm)form;
String id = request.getParameter("id");
BasDict item = this.dictBiz.get(Long.parseLong(id));
myForm.setItem(item);
return mapping.findForward("edit");
}
/**
* 执行 编辑操作
*/
public ActionForward doEdit(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception{
DictForm myForm = (DictForm)form;
this.dictBiz.update(myForm.getItem());
response.sendRedirect("dict.do?o=toList");
return null;
}
/**
* 执行 删除操作
*/
public ActionForward doDel(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception{
String id = request.getParameter("id");
this.dictBiz.del(Long.parseLong(id));
response.sendRedirect("dict.do?o=toList");
return null;
}
/**
* 转到 明细页面
*/
public ActionForward doDetail(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception{
DictForm myForm = (DictForm)form;
String id = request.getParameter("id");
BasDict item = this.dictBiz.get(Long.parseLong(id));
myForm.setItem(item);
return mapping.findForward("detail");
}
/* 注入Biz方法 */
private DictBiz dictBiz = null;
public void setDictBiz(DictBiz dictBiz){
this.dictBiz = dictBiz;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -