📄 deptaction.java
字号:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package org.lxh.struts.action;
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.apache.struts.actions.DispatchAction;
import org.lxh.factory.DAOFactory;
import org.lxh.struts.form.DeptForm;
import org.lxh.vo.Dept;
/**
* MyEclipse Struts Creation date: 06-12-2007
*
* XDoclet definition:
*
* @struts.action path="/dept" name="deptForm" input="/form/dept.jsp"
* parameter="status" scope="request" validate="true"
*/
public class DeptAction extends DispatchAction {
/*
* Generated Methods
*/
/**
* Method execute
*
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward insert(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
DeptForm deptForm = (DeptForm) form;
Dept d = new Dept();
d.setDname(deptForm.getDname());
d.setLoc(deptForm.getLoc());
d.setBusiness(deptForm.getBusiness());
try {
DAOFactory.getDeptDAOInstance().insert(d);
} catch (Exception e) {
e.printStackTrace();
}
return mapping.findForward("insertdo");
}
public ActionForward update(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
DeptForm deptForm = (DeptForm) form;
Dept d = new Dept();
d.setDeptno(deptForm.getDeptno());
d.setDname(deptForm.getDname());
d.setLoc(deptForm.getLoc());
d.setBusiness(deptForm.getBusiness());
try {
DAOFactory.getDeptDAOInstance().update(d);
} catch (Exception e) {
e.printStackTrace();
}
return mapping.findForward("updatedo");
}
public ActionForward delete(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
DeptForm deptForm = (DeptForm) form;
try {
DAOFactory.getDeptDAOInstance().delete(deptForm.getDeptno());
} catch (Exception e) {
e.printStackTrace();
}
return mapping.findForward("deletedo");
}
public ActionForward selectid(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
DeptForm deptForm = (DeptForm) form;
Dept d = null;
try {
d = DAOFactory.getDeptDAOInstance().queryByDeptno(
deptForm.getDeptno());
} catch (Exception e) {
e.printStackTrace();
}
request.setAttribute("dept", d);
return mapping.findForward("update");
}
public ActionForward selectdeptemp(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
DeptForm deptForm = (DeptForm) form;
Dept d = null;
try {
d = DAOFactory.getDeptDAOInstance().queryByDeptno(
deptForm.getDeptno());
} catch (Exception e) {
e.printStackTrace();
}
request.setAttribute("dept", d);
return mapping.findForward("listemp");
}
public ActionForward selectlike(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
List all = null;
try {
all = DAOFactory.getDeptDAOInstance().queryByLike(
request.getParameter("keyWord"));
} catch (Exception e) {
e.printStackTrace();
}
request.setAttribute("all", all);
return mapping.findForward("list");
}
public ActionForward selectall(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
List all = null;
try {
all = DAOFactory.getDeptDAOInstance().queryAll();
} catch (Exception e) {
e.printStackTrace();
}
request.setAttribute("all", all);
return mapping.findForward("list");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -