/** * 查询录入的书香卡 * * @param mapping * @param form * @param request * @param response * @return * @throws Exception */ public ActionForward query( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { MemberaddMoneyForm myForm = (MemberaddMoneyForm) form; Connection conn = null; try { conn = DBManager.getConnection(); MemberaddMoneyDAO moneyDao = new MemberaddMoneyDAO(); Collection list = moneyDao.findSxkRecordsByCondition(conn, myForm); request.setAttribute("list", list); request.setAttribute("memberaddMoneyForm", myForm); } catch (Exception e) { throw new ServletException(); } finally { if (conn != null) { conn.close(); } } return mapping.findForward("query"); }
public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { HttpSession session = request.getSession(); User user = new User(); user = (User) session.getAttribute("user"); Connection conn = null; CallableStatement cstmt = null; MemberaddMoney memberaddMoney = new MemberaddMoney(); /* * 取到所有值复选框的值 */ String inputid[] = request.getParameterValues("inputid"); try { conn = DBManager.getConnection(); for (int i = 0; i < inputid.length; i++) { memberaddMoney.setID(Integer.parseInt(inputid[i])); memberaddMoney.setMB_ID(0); memberaddMoney.setORDER_ID(0); memberaddMoney.setStatus(2); memberaddMoney.setOPERATOR_ID(Integer.parseInt(user.getId())); MemberaddMoneyDAO.update(conn, memberaddMoney); } return mapping.findForward("success"); } catch (SQLException se) { throw new ServletException(se); } finally { try { conn.close(); } catch (SQLException sqe) { throw new ServletException(sqe); } } }