In this exercise, you will build a simple web application. It performs some basic validation and processing of user input. This is done through proper configuration of Tomcat and JavaScript.
Part 1.1 Apache Tomcat – server.xml
1. Create your assignment submission folder: 3680-HW3-YourLastName-YourFirstName.
2. Use the submission folder as the deployment folder for your web application.
3. Inside the submission/deployment folder, create a subfolder by the name WEB-INF and another by the name images.
4. Download the file music.jpg from the course website into the images subfolder.
5. Configure server.xml so that on the web server you have a context (alias) with the name:
<lastName<firstInitial03 (replace the brackets and their contents with your last name and initial). For instance, for Justin Case, the context for his Assignment 3 is casej03.
6. Configure server.xml so that the alias you created in the previous step points to your
submission/deployment folder.
7. Write the default.htm page so that it looks like below. The page contains a picture of music notes (Hint: use the img tag and set its src property to the URI of music.jpg). Besides the Login hyperlink to login.htm, clicking this picture also opens up login.htm.
8. Start Apache Tomcat.
9. Test your server.xml configuration. You should be able to access default.htm by entering the URL: http://localhost:8080/<lastName<firstInitial03/default.htm (see above screenshot for what Justin Case should be able to see).
10. Once your website runs correctly, copy your server.xml from the /conf subfolder in the
Apache installation folder to the root of your submission/deployment folder.
Part 1.2 – Apache Tomcat – web.xml
1. Configure web.xml so that if a visitor of your website omits the filename behind the alias, he/she will see default.htm (see screenshot below), instead of the 404 error page.
2. Write a backup welcome page index.html. Also configure web.xml so that if default.htm is
missing in the deployment folder, the user should see the index.html instead of the 404 error page.
Part 2 – Handling User Input
1. Create an HTML page and name it login.htm.
2. The interface of login.htm should look like the following screenshot. Note that the checkbox for “Remember me” is checked by default.
3. When user enters a password, it should be masked:
4. Write JavaScript so that when a user clicks the Login button, his/her entries will be validated as follows: (a) If the user leaves the username field blank, the following dialog box appears:
(d) If the password does not match Tunes7, the following dialog box appears:
5. Once the user enters anything as username and Tunes7 as his/her password, he/she passes the
validation and he/she is directed to main.htm:
Submission
Due Date: Sun., March 13, 2016 (11:59 PM) Below are steps to follow for submission:
§ Submit your assignments only through Blackboard.
§ Assignments submitted to the instructor or grader by email will NOT be graded, unless you are instructed to do so.
§ Make sure in the 3680‐HW3‐YourLastName‐YourFirstName folder you have the following files: default.htm, index.html, login.htm, main.htm, server.xml, and the images and WEB-INF subfolders, each containing their respective contents to ensure the proper functioning of the web app.
§ Zip the folder into 3680‐HW3‐YourLastName‐YourFirstName.zip (RAR is fine too).
§ Submit the zip file as an attachment on Blackboard.
§ Before the assignment is due, you may resubmit your work for unlimited times. Simply attach a new version of your assignment. Only the attachment with the latest timestamp will be graded.
§ Failure to comply with these requirements will cause point deduction.