This assignment will give you practice with writing servlets.
In this assignment, you will create an on-line
store selling something, and use servlets to register customers,
track purchases and customer accounts.
The assignment is fairly open-ended. At the very minimum, we
are going to look for the following features:
- Your site should provide for "registration", where a customer
can create a username and password, enter address information and
be assigned an account. You can do this right up front or
during the "checkout" process.
- Your site should provide at least five different products,
along with prices and descriptions.
Customers should be able to purchase more than
one item during a visit. It should be possible to add items
to a shopping cart.
- Provide a checkout procedure that allows a customer to verify
what they have committed to purchase before finalizing the purchase.
- Only registered customers should be able to purchase.
- Registered customers should be able to view their account status.
- Other rules:
- Your webpages should consist only of standard HTML. They should
NOT contain Javascript, for example.
- For the backend, use only servlets. You may NOT use PHP or any
other such backend language.
- Use simple files as your database.
Apart from technical correctness, points will also be awarded for
originality, creativity, usefulness and humor.
To get started:
- Under
SimpleWebServerJar/webroot/
create a folder (directory) called
a4html.
- In this directory, make a simple HTML file called
home.html.
So, the URL to access this will be:
http://unix.seas.gwu.edu:40013/a4html/home.html
(Using your port number).
- We will assume that the file
home.html
be the starting point for your website.
- Under
SimpleWebServerJar/servlets/
create a folder (directory) called
a4servlets.
- Write a servlet called
A4Servlet.java
in the
a4servlets.
directory. For now, just to get started,
simply write something to the browser, just like
you did in the HelloWorld servlet. Compile it.
- Edit the
servlet.properties
file to add
A4Servlet.java
by adding the line:
servlet.A4Servlet.code=/servlets/a4servlets/A4Servlet
- Then run
java Serve
in the usual way and access the HTML file with
http://unix.seas.gwu.edu:40013/a4html/home.html
Similarly, access the servlet using URL
http://unix.seas.gwu.edu:40013/servlets/a4servlets/A4Servlet
- This is where you should implement your servlet code and
of course call this from the "form" tags of your HTML.
- The direct access of the servlet from the browser is only
to get started and to make sure the folder structure is working.
After that, you will only access
home.html
and from there, your servlets will generate the remaining HTML.
Deliverables and submission:
- You will upload three zip files:
- The first, called
a4html.zip,
will be a zip of your HTML in the
a4html
directory. This is all the HTML for your assignment.
- The second, called
a4servlets.zip,
will be a zip of all your servlets in the
a4servlets
directory.
- The third, called
a4.zip
should contain a single HTML file called
a4.html
and various images. When we open
a4.html
we should see various screenshots showing that you accomplished
the assignment.
- We will test by unpacking your zip files in the right places
and will use your port number.
- NOTE: (1) you must write ALL your servlet code. (2) All your
website code must be written using Java servlets. (3)
Apart from the standard libraries, you may not use any other Java
code. Nor can you use CSS, Javascript, PHP or any other web technology.
- You must use your assigned port number.