skip to Main Content
The smarter way
to do assignments.

Please note that this is just a preview of a school assignment posted on our website by one of our clients. If you need assistance with this question too, please click on the Order button at the bottom of the page to get started.

Part A – Modify your  The old LoginServlet passed control to an HTML file called AccountLookup.html.  Change this. Have the LoginServlet pass control to different JSP, called “”.Part B – Now build the file. This file will be different than the AccountLookup.jsp that we built in Lab #6. This JSP should get the Customer object out of the Session.  This Customer Object should contain the AccountList object that holds a list of Accounts. Then using scriptlet tags, display a table of accounts for this customer.AccountServlet.javapackage com.ChattBank.controller;import;import;import;import;import java.sql.SQLException;import java.util.ArrayList;import java.util.logging.Level;import java.util.logging.Logger;import javax.servlet.ServletException;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import javax.servlet.http.HttpSession;public class AccountServlet extends HttpServlet {protected void processRequest(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {response.setContentType(“text/html;charset=UTF-8”);try (PrintWriter out = response.getWriter()) {/* TODO output your page here. You may use following sample code. */out.println(““);out.println(““);out.println(““);out.println(“Servlet AccountServlet“);out.println(““);out.println(““);out.println(“
Servlet AccountServlet at ” + request.getContextPath() + “
“);out.println(““);out.println(““);}}// /** HTTP GET method */protected void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {//HttpSession session = request.getSession();String action = request.getParameter(“action”);if (action == null) {request.getRequestDispatcher(“/Welcome.jsp”).forward(request, response);} else if (action.equals(“view”)) {Accounts acct = new Accounts();ArrayList list = new ArrayList();try {acct.setCustAccounts(request.getParameter(“id”));list.addAll(acct.getCustAccounts());System.out.println(request.getParameter(“id”));//This was moved into the try block itselfrequest.setAttribute(“acctList”, list);request.getServletContext().getRequestDispatcher(“/accounts.jsp”).forward(request, response);} catch (SQLException ex) {Logger.getLogger(Accounts.class.getName()).log(Level.SEVERE, null, ex);//This is the added finally statement with the clearAccounts method} finally {acct.clearAccounts();}}}/** HTTP POST method */@Overrideprotected void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {String action = request.getParameter(“action”);String custId = request.getParameter(“custID”);if (action == null) {request.getRequestDispatcher(“/Welcome.jsp”).forward(request, response);}}/** Returns a short description of the servlet */@Overridepublic String getServletInfo() {return “Short description”;}// }accounts.jspYour Accounts list = new ArrayList();list.addAll((ArrayList)request.getAttribute(“acctList”));for (Account custAccount : list) {System.out.println(“From JSP: ” + custAccount.getCustId() + ” ” + custAccount.getAcctNo() + ” ” + custAccount.getAcctType() + ” ” + custAccount.getBalance());System.out.println(“Getting Object From Section”);}  %>

Your Chatt Accounts


Thank you for your business!


Clicking on this button will take you to our custom assignment page. Here you can fill out all the additional details for this particular paper (grading rubric, academic style, number of sources etc), after which your paper will get assigned to a course-specific writer. If you have any issues/concerns, please don’t hesitate to contact our live support team or email us right away.

How It Works        |        About Us       |       Contact Us

© 2018 | Intelli Essays Homework Service®

Back To Top