Question
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 ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started