Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a Java Web Project called TOBA and in it create the following HTML pages

ID: 2247152 • Letter: C

Question

Create a Java Web Project called TOBA and in it create the following HTML pages for our application. 10 pts

index.html : This will be the homepage of the application. If you’re aesthetically inclined, by all means make it pretty. At the very least, the homepage should have the name of the banking application and a navigation.

Login.html: This page should contain a form with the following input elements and a Login Button. This page should also have a link to a “New Customer Sign Up page”, see item c.

Username

Password

New_customer.jsp: This page will allow the user to register for online banking services. It should have a form with a submit button that collects the following information.

FirstName

LastName

Phone

Address

City

State

Zipcode

Email

Success.html: This page should just display a message that the account has been successfully created.

Account_activity.html: This page will be used to display the customer account information. Just add a header for now.

Transaction.html: This page will allow a user to post a transaction. Just add a header for now.

Login_failure.html: Displays a message that the login was incorrect.

Error_404.jsp: Displays 404 error code.

Error_java.jsp: Displays a message that java has thrown an exception.

Create the following Servlets: 10 pts

LoginServlet – Code the servlet to retrieve the username and password from the form we added to login.html. Have the servlet check that the username is equal to HYPERLINK "mailto:jsmith@toba.com" jsmith@toba.com and the password is equal to “letmein”. Make sure you use these values or I can’t test your work. If the username and password match, the servlet to forward the request to the account_activity.html page. If it is incorrect, it should forward the request to the login_failure.html page.

NewCustomerServlet – Code the servlet to retrieve the new customer form data and just redirect to the success.html page.

TransactionServlet – Just create an empty servlet for now.

Server Side Validation – Code the NewCustomerServlet to validate the user has entered in values for all the form fields. If not, assign a message variable such as “Please fill out all the form fields” and display the message on the new_customer.jsp page. 10 pts

Web XML - Configure the web.xml to map all your servlets. 10 pts

Error Handling – Add the following: 10 pts

XML tags that provide error-handling for an HTTP 404 status code

XML tags that provide error-handling for all Java exceptions

Explanation / Answer

Account_activity.html

<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
      
        <title>Activity</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    </head>
    <body>
       <nav>
            <a href="./index.html">Home</a> |
            <a href="./Login.html">Sign In</a> |
            <a href="./new_customer.html">Sign Up</a>
        </nav>
        <div>TODO write content</div>
    </body>
</html>

Error_404.jsp

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h1>Hello World!</h1>
    </body>
</html>


Error_java.jsp

<%--
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h1>Hello World!</h1>
    </body>
</html>

Login.html

<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <title>User Login Form</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    </head>
    <body>
      
        <h1>Online Services</h1>
        <nav>
            <a href="./index.html">Home</a> |
            <a href="./Login.html">Sign In</a> |
            <a href="./new_customer.html">Sign Up</a>
        </nav>
        <form action="UserLogin" method="Post">
            <table cellspacing="4" border="0">
                <tr>
                    <td align="center">User ID:</td>
                    <td><input type="text" name="UserIdent"></td>
                </tr>
                <tr>
                    <td align="center">Password:</td>
                    <td><input type="password" name="UserPass"></td>
                </tr>
                <tr>
                    <td align="right"></td>
                    <td><br><input type="submit" value="Login"></td>
                </tr>
            </table>
        </form>
        <h3>Not a Customer?</h3>
        <a href="//new_customer.html">Sign up Now!</a>
    </body>
</html>

Login_failure.html

<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <title>TODO supply a title</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    </head>
    <body>
        <nav>
            <a href="./index.html">Home</a> |
            <a href="./Login.html">Sign In</a> |
            <a href="./new_customer.html">Sign Up</a>
        </nav>
        <h1>Login Failed!</h1>
        <h2>Please check your username and password are correct</h2>
    </body>
</html>

Success.html

<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <nav>
            <a href="./index.html">Home</a> |
            <a href="./Login.html">Sign In</a> |
            <a href="./new_customer.html">Sign Up</a>
        </nav>
        <title>Account Created - Success</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    </head>
    <body>
        <h1>Success! Welcome to Titan Bank</h1>
        <h2>Account Created</h2>
    </body>
</html>

Transaction.html

<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <title>Transactions</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    </head>
    <body>
        <nav>
            <a href="./index.html">Home</a> |
            <a href="./Login.html">Sign In</a> |
            <a href="./new_customer.html">Sign Up</a>
        </nav>
        <div>TODO write content</div>
    </body>
</html>

index.html
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <title>Titan Bank Home</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    </head>
    <body>
        <h1>Titan Bank Online Banking</h1>
        <nav>
            <a href="./index.html">Home</a> |
            <a href="./Login.html">Sign In</a> |
            <a href="./new_customer.html">Sign Up</a>
        </nav>
      
    </body>
</html>

new_customer.html

<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <title>Titan Bank New User Sign up</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    </head>
    <body>
      
        <h1>Enter Your Information Below</h1>
        <nav>
            <a href="./index.html">Home</a> |
            <a href="./Login.html">Sign In</a> |
            <a href="./new_customer.html">Sign Up</a>
        </nav><br><br>
        <form action="AddNewCusomer" method="Post">
            <table cellspacing="4" border="0">
                <tr>
                    <td align="center">First Name:</td>
                    <td><input type="text" name="FirstName"></td>
                </tr>
                <tr>
                    <td align="center">Last Name:</td>
                    <td><input type="text" name="LastName"></td>
                </tr>
                <tr>
                    <td align="center">User ID:</td>
                    <td><input type="text" name="UserIdent"></td>
                </tr>
                <tr>
                    <td align="center">Password:</td>
                    <td><input type="password" name="UserPass"></td>
                </tr>
                <tr>
                    <td align="center">Phone:</td>
                    <td><input type="text" name="PhoneNum"></td>
                </tr>
                <tr>
                    <td align="center">Address:</td>
                    <td><input type="text" name="UserAddress"></td>
                </tr>
                <tr>
                    <td align="center">City:</td>
                    <td><input type="text" name="UserCity"></td>
                </tr>
                <tr>
                    <td align="center">State:</td>
                    <td><input type="text" name="UserState"></td>
                </tr>
                <tr>
                    <td align="center">Zip Code:</td>
                    <td><input type="text" name="UserZip"></td>
                </tr>
                <tr>
                    <td align="center">Email:</td>
                    <td><input type="text" name="UserEmail"></td>
                </tr>
                <tr>
                    <td align="center"></td>
                    <td><br><input type="submit" value="Submit"></td>
                </tr>
            </table>
    </body>
</html>