Department of Computing Science Umeå University

Assignment 2 - Web Applications

Due: 2008-08-01, 10:00

The assignment shall be solved individually.

The purpose of this assignment is to introduce the concept of web applications, and to give student experience in JSP web application development.

In this assignment, you will create a web application for a small online shop. Data used in your shop application will be stored in a simulated database and accessed via a provided database accessor. Data stored in the database shall be validated and sanity checked before storage. Your solution shall also contain a session-based shopping cart, where users can store and remove products, as well as an administration interface for the shop database.

You are free to choose the appearance and theme (what type of products and how they are presented) of your application, but a minimal functionality set required includes

  • a page which lists the products available, by category and by product (use of paging is recommended -- displaying hundreds or even thousands of items on a single page is not allowed)
  • a page that shows detailed information about products
  • an administration interface where administrators can add, update, and delete products from the database (typically not available to customers)
  • a shopping cart page which shows the current content of shopping carts (complete with interfaces for adding and removing products)
  • a search page, where customer can search for products (based on product name and description)
If you are looking for ideas on how to structure your shopping site, take a look at Amazon.com or a similar shopping site.

Laboration environment

Download products.jar and place it in your web applications library directory (5dv076/username/web/WEB-INF/lib).

This JAR-file contains a data access layer for a two-layer web application architecture. The system is provided in a Java package called products which contains the following classes:

products.Id                                 <- a UUID wrapper class
products.Product                            <- a product representation
products.ProductAccessor                    <- an accessor interface for the products database
products.ProductAccessorSimulator           <- a simulated implementation of the accessor
products.ProductAccessorSimulator.Factory   <- a factory class for the simulator

Javadoc documentation is available for the products framework.

The products in this system contains six data fields: id, name, description, arrivalDate, nrInStock and category. The Product class contains get methods for each of them.

The accessor interface contains methods for querying the system for number of products, retrieving a range of products (by product and by category), retrieving a specified product, inserting and updating products and searching for products (based on product name and description).

Using the system: To use the system you simply instantiate an accessor:

  ProductAccessor accessor = ProductAccessorSimulator.Factory.getInstance();
and retrieve, store or search for the data you are interested in:
  int nrProducts = accessor.getNrProducts();
  Product[] products = accessor.getProducts(offset,limit);
  int nrProductsByCategory = accessor.getNrProducts();
  Product[] productsByCategory =
    accessor.getProductsByCategory(category,offset,limit);
  Product product = accessor.getProduct(id);
  accessor.insertProduct(product);
  accessor.updateProduct(product);
  Product[] productsByName =
    accessor.searchProductsByName(name,offset,limit);
  Product[] productsByDescription =
    accessor.searchProductsByDescription(description,offset,limit);
  ProductAccessorTester.testAccessor(accessor);
Note that the search methods accept partial string matches, while the getProductsByCategory() method requires an exact category string match. E.g., you can find all products with names that contain the string "product" by performing a search on the substring "prod".

See the environment page for details on installing and using the laboration environment.

Examination

Place a WAR-file containing your solution in

~/edu/5dv076/assignment2/

Java source code should be placed in

~/edu/5dv076/assignment2/src/

You laboration report should be placed in

~/edu/5dv093/assignment2/report/

Due date

2008-08-01, 10:00

http://www.cs.umu.se/kurser/5DV093/SOM-08/assignments/2/index.html
Ansvarig för sidan: P-O Östberg
Senast ändrad 2008-06-23