首页>代码>java Struts+Hibernate企业人力资源管理系统源代码下载>/rencaiSystem/src/com/sanqing/action/InstitutionAction.java
package com.sanqing.action; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.hibernate.HibernateException; import com.sanqing.dao.InstitutionDao; import com.sanqing.po.Institution; /** * @author BWeiMing * */ public class InstitutionAction extends Action { private InstitutionDao dao=new InstitutionDao(); public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String action =request.getParameter("action"); System.out.println("\nInstitutionAction*********************action="+action); if(action==null||"".equals(action)){ return mapping.findForward("error"); }else if("listinstitution".equals(action)){ return listInstitution(mapping,form,request,response); }else if("addinstitution".equals(action)){ return addInstitution(mapping,form,request,response); }else if("updateinstitution".equals(action)){ return updateInstitution(mapping,form,request,response); }else if("deleteinstitution".equals(action)){ return deleteInstitution(mapping,form,request,response); }else if("detailinstitution".equals(action)){ return detailInstitution(mapping,form,request,response); } return mapping.findForward("error"); } /** * @param mapping * @param form * @param request * @param response * @return * @throws HibernateException */ private ActionForward detailInstitution(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws HibernateException { Long id=new Long(request.getParameter("id")); Institution i=dao.loadInstitution(id.longValue()); request.setAttribute("institution",i); return mapping.findForward("success"); } /** * @param mapping * @param form * @param request * @param response * @return * @throws HibernateException */ private ActionForward deleteInstitution(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws HibernateException { Long id=new Long(request.getParameter("id")); Institution i=new Institution(); i.setId(id); dao.deleteInstitution(i); return mapping.findForward("success"); } /** * @param mapping * @param form * @param request * @param response * @return * @throws HibernateException */ private ActionForward updateInstitution(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws HibernateException { InstitutionForm institutionForm=(InstitutionForm)form; Institution i=institutionForm.populate(); dao.updateInstitution(i); return mapping.findForward("success"); } /** * @param mapping * @param form * @param request * @param response * @return * @throws HibernateException */ private ActionForward addInstitution(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws HibernateException { InstitutionForm institutionForm=(InstitutionForm)form; Institution i=institutionForm.populate(); dao.addInstitution(i); return mapping.findForward("success"); } /** * @param mapping * @param form * @param request * @param response * @return * @throws HibernateException */ private ActionForward listInstitution(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws HibernateException { request.setAttribute("list",dao.listInstitution()); return mapping.findForward("success"); } }

qfch120 LV8
2023年3月29日
wuying8208 LV15
2023年1月1日
yuanjuntao LV5
2022年7月5日
2297542298 LV2
2022年1月11日
1637947149 LV3
2021年11月20日
lucky金 LV3
2021年8月26日
Qolmen LV12
2021年7月20日
吴峰123456 LV4
2021年7月13日
Demo1111 LV30
2021年6月7日
Crush LV3
2021年5月10日

Solowen
4月16日
暂无贡献等级
hawkzl LV2
4月2日
benben2020
3月19日
暂无贡献等级
charies778
1月7日
暂无贡献等级
krispeng LV14
2024年8月12日
嘻嘻哈哈的小洋
2024年4月26日
暂无贡献等级
123456wadff LV3
2024年1月15日
Henew168 LV2
2023年11月19日
2036495585 LV9
2023年9月25日
zhangyanghao
2023年9月21日
暂无贡献等级