DeparModAction.java~15~
上传用户:dlqqsh
上传日期:2021-11-13
资源大小:7840k
文件大小:1k
源码类别:

OA系统

开发平台:

Java

  1. package officeol.mc.actions;
  2. import org.apache.struts.action.ActionMapping;
  3. import org.apache.struts.action.ActionForm;
  4. import javax.servlet.http.HttpServletRequest;
  5. import javax.servlet.http.HttpServletResponse;
  6. import org.apache.struts.action.ActionForward;
  7. import org.apache.struts.action.Action;
  8. import officeol.mc.tools.*;
  9. public class DeparModAction extends Action {
  10.     public ActionForward execute(ActionMapping mapping, ActionForm form,
  11.                                  HttpServletRequest request,
  12.                                  HttpServletResponse response) {
  13.         try{
  14.             request.setCharacterEncoding("GBK");
  15.             String depname = request.getParameter("depname");
  16.             String depsm = request.getParameter("depdes");
  17.             String deid = request.getParameter("deid");
  18.             Tool tl = new Tool();
  19.             DBConn dbc = new DBConn();
  20.             String dnmd5 = tl.hash(depname);
  21.             String desql = "update deparment set deparname = '"+depname
  22.                            +"',shuoming = '"+depsm+"', dnmd5 ='"+dnmd5+"' where id = "+deid;
  23.             //System.out.println(desql);
  24.             dbc.executeUpdate(desql);
  25.             request.setAttribute("msg","用户部门 "+depname+" 修改成功!");
  26.             return mapping.findForward("succ");
  27.         }catch(Exception ex){
  28.             ex.printStackTrace();
  29.             request.setAttribute("msg","用户部门 "+depname+" 出现异常!");
  30.         }
  31.         return mapping.findForward("err");
  32.     }
  33. }