public List<Transaction> getTransList(int accountNo) { StorageDB sdb = new StorageDB(); try { transList = sdb.txListC(accountNo); } catch (NumberFormatException e) { e.printStackTrace(); } catch (ParseException e) { e.printStackTrace(); } return transList; }
/** @see Servlet#destroy() */ public void destroy() { try { sdb.getConnection().close(); sdb = null; } catch (SQLException e) { e.printStackTrace(); } }
/** @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String username = request.getParameter("username"); String password = request.getParameter("password"); int accNo = sdb.validateUser(username, password); TreeMap<String, String> values = sdb.findName(accNo); PrintWriter out = response.getWriter(); if (accNo <= 0) { out.println("<h4><center>Invalid Credentials, Try again</center></h4>"); RequestDispatcher rd = request.getRequestDispatcher("/BankLoginPage.html"); rd.include(request, response); } else { HttpSession session = request.getSession(); session.setAttribute("accNo", accNo); session.setAttribute("accountName", values.get("name")); session.setAttribute("balance", values.get("balance")); // session.setAttribute("transactions", transactions); RequestDispatcher rd = request.getRequestDispatcher("/MemberAccountPage.jsp"); rd.forward(request, response); } }