Web programming

Units WEB1P and WEB2P

Development task (Task A)

Your task is to implement a web application that has the following functionality:

  1. It must provide an online airline booking facility.
  2. A booking consists of a flight and a passenger.
  3. The information entered about a flight must include the following:
    1. The flight number (consisting of 2 letters followed by 1-4 digits, e.g. BA963), which must be present
    2. The date of the flight (in the format dd/mm/yyyy, e.g. 09/01/2009), which must be present
  4. The information entered about a passenger must include the following:
    1. Their name (identifying their firstname(s) and lastname separately), which must be present
    2. Their address, including a valid postcode if it is in the UK
    3. Their phone number, which, if present, can validly be in any one of the formats illustrated below (where spaces are not significant):
      1. +44 (23) 92846438
      2. (023) 92846438
      3. 023 92846438
    4. Their email address, which must be present and in a valid format.
  5. If the user enters an invalid booking, the system indicates to the user where invalid data has been entered and provides them with an opportunity to correct it.
  6. The application must allow persistent storage of valid airline bookings in a database.
  7. For the purposes of this exercise:
    1. two flights are identical if they have the same flight number and date
    2. two passengers are identical if they have the same lastname, forename, postcode (which might be blank) and country
    3. a new flight is created if it does not already exist in the database
    4. a new passenger is created it they do not already exist in the database
    5. a new booking is created if one for the stipulated passenger does not already exist on the stipulated flight
  8. Each flight has a maximum number of passengers (which must be stored in the flight details). Once that number has been reached, further bookings for the same flight should be rejected. Assume that all flights have the same maximum, which is specified as a context parameter in the web.xml file.
  9. The user must be able to request a report showing the details of all flights, passengers and bookings held by the system.

Validation of bookings (where possible) is to be done both at the client and at the server side. However, a checkbox must be provided on the entry form which, if checked, disables client-side checking completely.

Notes

You must develop your solution using HTML, JavaScript, Java servlets and JSPs as appropriate. You may use Java frameworks as appropriate.

The code written should be of "good quality", viz. exhibit good layout and readability, and possess good structure (using classes, packages and inheritance where appropriate). User interfaces should be clear and accessible, and require minimum effort on the part of the user to perform the most common operations. The reuse of existing code is encouraged (including publically available/open-source material), but must be acknowledged. Aim to keep the length of your methods short.

Advice

  1. Think carefully about the design of objects to represent the entries. What properties should they have and what type should the properties be? What other operations (methods) should be applicable to an address book entry object?
  2. The Model-View-Controller (MVC) pattern is a good way of structuring a web application. Think carefully about how you can structure your code to achieve this separation.
  3. Use the online documentation and your reference books.
  4. Don't leap into coding. Make sure you have a feasible design for your solution before you start programming it.
  5. Allow plenty of time to integrate separately developed parts of the program. It is often only at this stage that you find flaws in the design.
  6. You may reuse code taken from elsewhere (including textbooks and the web), but such code MUST be clearly distinguished and the source of it MUST be acknowledged by a comment in the program listing.
  7. Develop your code in small parts. Test each part as you implement it. Run your program frequently – don’t add more than about 10-15 lines of code (at maximum) without compiling it to check what you’ve done. Use the breakpoint debugger to run the program to find out whether variables have the values you think they should have. Think carefully about the design of each part of your program. Don’t reject well thought out code just because you get compilation errors – work out why you’ve got an error and correct it, don’t throw away the good with the bad. Don’t be over ambitious.

Constraints

Resources

The webapp1 and jpa web applications contain example code that you may find useful in this assessment.

You may find it useful to use some of the Java Collections Framework classes (java.util.*).

You may use any SQL-compatible database management system such as JavaDB (shipped with NetBeans 5.5 or later) or MySQL. You may chose to use JPA/Hibernate to intermediate your database operations, or write your own code to use the JDBC API. Using JPA/Hibernate will tend to attract a higher mark.

 

Last updated by Prof Jim Briggs of the School of Computing at the University of Portsmouth

 
The web programming units include some material that was formerly part of the WPRMP, WECPP, WPSSM and WEMAM units.