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

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 UserModAction extends Action {
  10.     public ActionForward execute(ActionMapping mapping, ActionForm form,
  11.                                  HttpServletRequest request,
  12.                                  HttpServletResponse response) {
  13.         try{
  14.             request.setCharacterEncoding("GBK");
  15.             DBConn dbc = new DBConn();
  16.             Tool tl  = new Tool();
  17.             String unmd5 = request.getParameter("username");
  18.             if(unmd5==null){
  19.                 request.setAttribute("msg", "请选择用户!");
  20.                 return mapping.findForward("err");
  21.             }
  22.             String un = request.getParameter("un");
  23.             String xm = request.getParameter("xm");
  24.             String sex = request.getParameter("sex");
  25.             String tel = request.getParameter("tel");
  26.             String tel2 = request.getParameter("tel2");
  27.             String email = request.getParameter("email");
  28.             String sql = "update [user] set deparment = '"+dep+"' where unmd5='"+unmd5+"'";
  29.             int i = dbc.executeUpdate(sql);
  30.             if(i!=0){
  31.                 request.setAttribute("msg", "用户 " + un + " 修改成功!");
  32.                 return mapping.findForward("succ");
  33.             }else{
  34.                 request.setAttribute("msg", "用户 " + un + " 修改出错,请重试!");
  35.                 return mapping.findForward("err");
  36.             }
  37.         }catch(Exception ex){
  38.             ex.printStackTrace();
  39.             request.setAttribute("msg","用户修改出现异常,请重试!");
  40.         }
  41.         return mapping.findForward("err");
  42.     }
  43. }