Assignment #4 - Java Servlets and JSPs
COMP 2513 Introduction to E-Commerce Technology

This assignment is based on information we have covered on JavaServlets, Java Server Pages and JavaBeans.  You will gain hands-on experience in three major areas: (1) developing servlets and JSPs, (2) the advantages of JSPs over servlets, and (3) an introduction to the JSP tags and JavaBeans that are used in your E-Commerce store.  PLEASE COMPLETE AND SUBMIT THIS ASSIGNMENT AS A STORE TEAM.

There are three parts to this assignment.  Part A has you develop a servlet version of you madlib.  Part B has you do the same using a JSP.  Part C has you modify the front page of your team's store through changes to your database and the index.jsp file.

Part A:  (30%)

You have studied the source code and operation of several Java servlets in class and during tutorials (see the course notes on Java servlets).  You must use the knowledge you have acquired to rebuild the CGI madlib developed in Assignment 3 into a Java servlet (sorry, no bonus marks for checking FORM fields this time).  In addition, a heading at the top of the resulting output should greet the user with an announcement of "Good morning (or afternoon)" as appropriate as well as a display of the current date and time.

Part B:  (35%)

We have reviewed several JSPs and their souce code and related Java Beans.  It is now time to demonstrate your skill in using them. Write a JSP version of your madlib developed in Part A including a heading that is generate by a Java Bean that displays the current date and time.  Keep the static HTML presentation components separated as much as possible from the dynamic Java components.  In addition, the JSP should demonstrate each of the following: a JSP comment, a directive, a declaration, a scriplet and an expression.

Part C:  (35%)

This section of the assignment will make the connection between adding information to your stores database with the admin loader and displaying that information via a JSP.  In addition you will create and use a session attribute and become familiar with some of  the JSP tags that are used to access your store's database.  PLEASE ENSURE YOU HAVE BACKED UP *ALL*  STORE DIRECTORIES TO YOUR LAPTOP BEFORE BEGINNING.

Begin by using the admin web application to add to the name of your store.  For example change the name from "Store01" to "Store01 -  Atlantic Sports Online".   Backup the original index.jsp file and modify it so that static and dynamic content presents your own unique storefront.  Look at some of the past Comp2513 stores and some real stores on the web and then be imaginative and creative in your use of text, images, sound and web application technology.  The static content, should provide the style of your page (e.g. use of colors) and basic information that will not change (e.g. a logo).   The dynamically generated content must include all elements of the original index.jsp as well as the current date and time. 

Add to the index.jsp homepage a registration section where a customer can enter their name as a preferred customer.  This input should be used to create a persistent cookie (that will remain in effect between sessions and even after the customer reboots his laptop) called CustomerName that can be checked to see if the person  has previously registered at your store.  If so the index.jsp page should provide a welcome message such as "Welcome back, <CustomerName>!".

Please Note:
-- For Part C you can modify your code using NetBeans or Eclipse but it will not run until placed on the server (because it requires the database).  HINT:  Develop and test the registration (session attribute problem) as a separate piece of code locally on your laptop and then integrate with index.jsp at your store on eagle.

-- The .jsp files can be placed anywhere in your stores directory structure whereas JavaBeans (.class files) must be located in the WEB-INF classes directory
-- If you feel you want to expand on this assignment you can do so, but ensure that the Core Requirements are covered, as that is the basis for marking.

Submitting your Assignment:

PLEASE NOTE CAREFULLY FOR FULL MARKS:   Provide your TAs with the URL links to both the working .class and .jsp files as well as to the source code; i.e. the .java and .jsp files.   They have access to you directories so they will be able to review your code.   Please ensure you comment your code whenever you feel there is need to clarify your programming and to get full marks.