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 address book facility.
  2. The information entered about a person must include the following:
    1. Their name (identifying their firstname(s) and lastname separately), which must be present
    2. Their company/organisation name, which may be absent
    3. Their address, including a valid postcode if it is in the UK
    4. 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. x6438
    5. Their email address, which must be present and in a valid format.
  3. In addition, each entry must contain the date and time when it was last updated.
  4. The application must allow persistent storage of valid address book entries in a database.
  5. It must allow searching of entries to find those matching a pattern specified by the user. The match could be with the name, address or any other piece of information stored.
  6. It must allow entries to be amended by the user.
  7. The user must be able to request a report showing the details of all entries held by the system.
  8. If the user enters an invalid entry, the system indicates to the user where invalid data has been entered and provides them with an opportunity to correct it. Invalid data must not be persisted to the database.

Validation of entries (where possible) is to be done both at the client and at the server side. However, a checkbox should 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 Apache Derby (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.

 

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.