UpModAction.java~9~
资源名称:bangong.rar [点击查看]
上传用户:dlqqsh
上传日期:2021-11-13
资源大小:7840k
文件大小:1k
源码类别:
OA系统
开发平台:
Java
- package officeol.mc.actions;
- import org.apache.struts.action.ActionMapping;
- import org.apache.struts.action.ActionForm;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import org.apache.struts.action.ActionForward;
- import org.apache.struts.action.Action;
- import officeol.mc.tools.*;
- public class UpModAction extends Action {
- public ActionForward execute(ActionMapping mapping, ActionForm form,
- HttpServletRequest re,
- HttpServletResponse response) {
- try{
- re.setCharacterEncoding("GBK");
- DBConn dbc = new DBConn();
- int count = Integer.parseInt(re.getParameter("count"));
- String[] pids = new String[count];
- String[] insql = new String[count];
- String[] uids = new String[count];
- for(int i = 0; i < pids.length; i ++){
- pids[i] = re.getParameter("pope"+i);
- uids[i] = re.getParameter("uid"+i);
- insql[i] = "insert into userpope (popeid,userid) values ('"+
- pids[i]+"','"+uids[i]+"')";
- //System.out.println("upAdd insql: "+ insql[i]);
- dbc.executeUpdate(insql[i]);
- }
- re.setAttribute("msg","添加成功!");
- }catch(Exception ex){
- ex.printStackTrace();
- re.setAttribute("msg","修改出错,请重试!");
- }
- return mapping.findForward("succ");
- }
- }