public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { Connection conn = null; MemberDAO memberDAO = new MemberDAO(); // String member_id = request.getParameter("member_id"); String member_id = ""; try { conn = DBManager.getConnection(); /** 如果是callcenter系统,从sessin中取出会员信息,如果没有提示登录服务对象 * */ String iscallcenter = request.getParameter("iscallcenter"); if (iscallcenter != null && iscallcenter.equals("1")) { CallCenterHander hander = new CallCenterHander(request.getSession()); if (hander.isOnService()) { Member mb = hander.getServicedMember(); member_id = String.valueOf(mb.getID()); } else { ControlledError ctlErr = new ControlledError(); ctlErr.setErrorTitle("操作错误"); ctlErr.setErrorBody("没有服务对象,请接入服务"); request.setAttribute(Constants.ERROR_KEY, ctlErr); return mapping.findForward("controlledError"); } } String cardId = MemberDAO.getCard_ID(conn, Integer.parseInt(member_id)); request.setAttribute("cardId", cardId); Collection memberGetMemberCol = memberDAO.MBR_GET_MBR_info(conn, member_id); request.setAttribute("memberGetMemberCol", memberGetMemberCol); return mapping.findForward("success"); } catch (SQLException se) { throw new ServletException(se); } finally { try { conn.close(); } catch (SQLException sqe) { throw new ServletException(sqe); } } }
public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { RoleForm rf = (RoleForm) form; Role role = new Role(); PropertyUtils.copyProperties(role, rf); Connection conn = null; System.out.println("role delete 000000"); try { // DataSource dts = getDataSource(request); conn = DBManager.getConnection(); // check if the role is in use conn.setAutoCommit(false); UserRoleDAO userRoleDao = new UserRoleDAO(); Collection userRoleCol = userRoleDao.find(conn, role); System.out.println("role delete 111111111"); if (userRoleCol != null && userRoleCol.size() > 0) { System.out.println("role delete 222222222"); ControlledError ctlErr = new ControlledError(); ctlErr.setErrorTitle("删除角色错误"); ctlErr.setErrorBody("角色正在使用中,不能删除"); request.setAttribute(com.magic.crm.util.Constants.ERROR_KEY, ctlErr); return mapping.findForward("controlledError"); } RoleDAO dao = new RoleDAO(); RoleRightDAO roleRightDao = new RoleRightDAO(); roleRightDao.delete(conn, role); System.out.println("role delete 3333333"); dao.delete(conn, role); System.out.println("role delete 4444444"); conn.commit(); return mapping.findForward("success"); } catch (SQLException se) { throw new ServletException(se); } finally { try { conn.close(); } catch (SQLException sqe) { throw new ServletException(sqe); } } }