Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part I - Modify your DisplayAccount.jsp from Lab #7. In Lab #7, your AccountLookupServlet used the Account object to lookup one Account and then passed

Part I - Modify your DisplayAccount.jsp from Lab #7. In Lab #7, your AccountLookupServlet used the Account object to lookup one Account and then passed control to the DisplayAccount.jsp which used scriptlet tags to display the Account info. In this Lab use the UseBean/GetProperty tags to display the Account info. (15 points only)

OR

(Part A & Part B = 40 Points)

Part A - Modify your AccountLookup.html file, from Lab #2. Add one new item to this HTML file. Add a link that says: "View All Accounts". Make it so when the user clicks this link, it will go to the DisplayAccounts.jsp. We will build this JSP in Part B, below.

Below is the AccountLookup.html

Account Lookup

AcctNo: CustomerID: Type: Balance:

Part B - Now criate a new JSP, called DisplayAccounts.jsp. This JSP will be different than the AccountLookup.jsp that we built in Lab #7. 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 all the accounts for the customer that logs in.

Below is=AccountLookup.jsp import javax.servlet.*; import javax.servlet.http.*; import java.io.*; public class LoginServlet extends HttpServlet { public void doGet ( HttpServletRequest req, HttpServletResponse res ) throws ServletException, IOException { String message, user, pw; String nextURL; //Get the user name and password from the HTML Form user = req.getParameter("uname"); pw = req.getParameter("pw"); System.out.println("Received the user name " + user + " and password of " + pw);

//Get the Customer information from the database using the Customer Business Object. Customer aCustomer = new Customer(); aCustomer.setUserName(req.getParameter("uname")); aCustomer.setPassword(req.getParameter("pw")); //Check that the pw from the DB is the same as the one from the HTML Form if (aCustomer.getPassword().equals(pw)) { //If the pw is correct, creeate a Session object HttpSession session = req.getSession(); //Put the Customer Business Object in the Session object session.setAttribute("customer", aCustomer); //Use the RequestDispatcher to forward control to the AccountLookup Servlet nextURL = "/Lab7/AccountLookupServlet"; } else { //If the pw is incorrect, use the RequestDispatcher to forward control to the ErrorPage Servlet nextURL = "/Lab7/ErrorPage.jsp"; } //Send the user to the next page res.sendRedirect(nextURL); } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Part I Modifying DisplayAccountjsp 1 Replace scriptlet tags with UseBeanGetProperty tags ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions

Question

What are the responsibilities of the position?

Answered: 1 week ago