UpModAction.java~13~
上传用户: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 UpModAction extends Action {
  10.     public ActionForward execute(ActionMapping mapping, ActionForm form,
  11.                                  HttpServletRequest re,
  12.                                  HttpServletResponse response) {
  13.         try {
  14.             re.setCharacterEncoding("GBK");
  15.             DBConn dbc = new DBConn();
  16.             int count = Integer.parseInt(re.getParameter("count"));
  17.             String[] pids = new String[count];
  18.             String[] insql = new String[count];
  19.             String[] uids = new String[count];
  20.             for (int i = 0; i < pids.length; i++) {
  21.                 pids[i] = re.getParameter("pope" + i);
  22.                 uids[i] = re.getParameter("uid" + i);
  23.                 insql[i] = "update userpope set popeid = '"+
  24.                            pids[i]+"' where userid = '"+uids[i]+"'";
  25.                 System.out.println("upMod insql: "+ insql[i]);
  26.                 //dbc.executeUpdate(insql[i]);
  27.             }
  28.             re.setAttribute("msg", "添加成功!");
  29.         } catch (Exception ex) {
  30.             ex.printStackTrace();
  31.             re.setAttribute("msg", "修改出错,请重试!");
  32.         }
  33.         return mapping.findForward("succ");
  34.     }
  35. }