Help/Advice/Example Code Needed for This Project
- From: "beg_java_prog" <beginner_java_programmer@xxxxxxxxx>
- Date: Thu, 29 Sep 2005 03:23:34 -0400
This assignment is intended to familiarize you with functionality for
maintaining state in user applications, with a focus on login and
navigation. For this assignment, you will need to submit the following
separate files:
RegLoginServlet.java - Java source code for your registration / login
servlet.
CatServlet.java - Java source code for your catalog index servlet.
Item1Servlet.java - Java source code for one item category servlet.
Item2Servlet.java - Java source code for another item category servlet.
ShopCartServlet.java - Java source code for the shopping cart servlet.
PurchConfServlet.java - Java source code for the purchase confirmation
servlet.
Individual supplementary files - images, style sheets, etc.
a3.zip - Compressed zip archive, packaging source files and supplementary
files in a single flat directory. Yes, this provides an archive of the
same material in the individual submissions, and yes, you need to submit
both.
a3.war - Web application archive file, appropriately packaging all
deployable elements.
info.txt - Text file (not word processor document) with the following
assignment information.
Explanation of user information persistence mechanism.
Explanation of status and stopping point, if incomplete.
Explanation of additional features, if any.
Create the following servlet functionality that allows a user to create an
account, login, select items for a shopping cart, and checkout.
As in previous assignments, the servlet-delivered HTML must provide the
basic form and elements shown in the images accompanying the assignment.
You may customize the look and feel somewhat (color, background,
additional decoration, different items, etc.), but you must provide the
form and element structure as given in the illustrations. Servlet
responses with user error messages must provide additional, clear, and
distinctive information, such as red text nearby the field to be
corrected, beyond what is shown in the accompanying images.
HTML content must be generated directly and programatically by the
servlets and not by, for example, redirecting to a static HTML page.
Register and Login
This servlet should maintain persistent user information (usernames and
passwords) as part of its internal state (not in secondary storage, e.g.,
database or file). Yes, this means it will reset each time the servlet is
re-started.
This servlet will handle logout as well as login functionality. When
accessed, it should check to see whether there is already a valid and
currently active session. If there is, that session should be invalidated,
so that a new one will start on login. Logout functionality can thus be
handled by directing to this page.
If the servlet is accessed with no user information at all, it should
display the login form.
If the servlet is accessed with user information, it should validate the
user information and respond accordingly.
If password or confirmation are present, but no username is present, it
should display the login page again, with a contextual error message
requesting a username.
For existing user login (no password confirmation), if the username exists
but the password is empty or incorrect, it should display the login page
again (retaining the username), with an appropriate contextual error
message for each condition.
For new user registration (with confirmation present), if the username
already exists, it should display the login page again (without the
entered username), with an appropriate contextual error message. If the
password and confirmation are not the same, it should display the login
page again (retaining the entered username), with an appropriate
contextual error message.
If the user data validates (either previous user with correct password or
new user with matching password and confirmation), user information should
be stored in the session, and the user should be taken to the Catalog Index
page.
Session Validation
For each servlet other than registration / login, when accessed, the
servlet should check to see (1) whether there is already a valid and
currently active session, and (2) user data is present. If not (e.g., that
servlet was accessed directly), the user should be redirected to the login
page.
Catalog Index
Display a welcome message, tailored for the appropriately logged in user
of this session.
Display a list of links to individual categories of catalog listings (at
least 2).
Provide menu links to:
Logout, which returns to the login page, clearing the session.
View Cart, which takes the user to the shopping cart page for this
session.
Item
Display the username of the appropriately logged in user of this session.
Displays a list of items in a given category. The list should be populated
with several items. Item information should include:
Thumbnail image of the item.
Text description of the item.
Individual item cost.
Button that will add the particular item to the user's shopping cart. This
will be an individual form/submission for each listed item. In this
assignment, we are not implementing the shopping cart functionality, so
each button should simply link to the shopping cart display.
Provide menu links to:
Logout, which returns to the login page, clearing the session.
View Cart, which takes the user to the shopping cart page for this
session.
Return the user to the catalog index page for this session.
Shopping Cart
Display the username of the appropriately logged in user of this session.
Display current shopping cart information, allowing for entry of shipping
and credit card information. Since we are not implementing the actual
shopping cart functionality in this assignment, simply display at least
one example item (thumbnail, description, individual cost, quantity).
Allow for change in the quantity of a given item. Each quantity change
button should be an individual form/submission. Since we are not
implementing the actual shopping cart functionality in this assignment,
each button should simply link to the shopping cart page itself.
Allow for submission of the entire purchase, taking the user to the
confirmation page.
Provide menu links to:
Logout, which returns to the login page, clearing the session.
Return the user to the catalog index page for this session.
Purchase Confirmation
Display the username of the appropriately logged in user of this session.
Display purchase confirmation information, corresponding to the example
Shopping Cart information.
Provide menu links to:
Logout, which returns to the login page, clearing the session.
Return the user to the catalog index page.
Notes:
Sessions should use the servlet session interface, not cookies or url
rewriting directly.
For handling persistent user information in this assignment
(login/password only), you will need to select a method of storing it
between interactions, in memory at the very least. Credit will be given
for sensible operational persistence, not on the complexity of the method,
although we encourage exploring creative solutions. You might choose, for
example, to keep the information in a hash table maintained in servlet
memory. In a proper e-commerce application the data would most likely be
stored in a database, but we are not quite there yet.
Form submission should use the POST method.
Names for the form elements should be as follows:
user for Requested Username
pass for Password
confpass for Confirm Password
shipto for Shipping Address
shipservice for Shipping Company Service Type
cctype for Credit Card Type
ccnum for Credit Card Number
ccname for Credit Card Holder Name
ccexpmonth for Credit Card Expiry Month
ccexpyear for Credit Card Expiry Year
Something sensible for items (e.g., item number)
.
- Follow-Ups:
- Re: Help/Advice/Example Code Needed for This Project
- From: Roedy Green
- Re: Help/Advice/Example Code Needed for This Project
- Prev by Date: Servlet's doPost() results in jsp file not found error
- Next by Date: Re: output ascii text file
- Previous by thread: Servlet's doPost() results in jsp file not found error
- Next by thread: Re: Help/Advice/Example Code Needed for This Project
- Index(es):