Enterprise web programming

Modules ENTWA (Level 6) and APSW (Level 7)

Java EE exercise 2

Aim

The aim is to familiarise yourself with:

Exercise

Further develop the Java EE web application you created in exercise 1 to store and retrieve records in/from a database.

You can solve a problem of your own choosing (e.g. if there is something you want to do related to your project or other coursework), or if you can't think of one, use the example below.

Example problem

The requirements of the system are (in recommended order of implementation, and in addition to the requirements set out in exercise 1):

  1. Web application.
  2. Entry page displays a list of people and their contact details. When the application is first run, this list will be empty.
  3. Entry page also has a form that allows the user to add a person and their contact details to the list. Once added, the entry page is shown again with an updated list displayed.
    1. Hint: store the list internally in a managed bean - make the managed bean session-scoped.
    2. Hint: maintain an MVC pattern throughout development of your solution.
    3. Hint: use one class to store a person and their contact details.
  4. Add user input validation to the application (e.g. name must not be empty; email address must conform to standard syntax, etc.)
  5. Add a "delete" button next to each displayed person that, when pressed delete's their entry from the list (and redisplays the entry page).
  6. Add an "edit" button next to each displayed person that brings up a separate page containing a form pre-populated with their details, allows them to be edited (with validation), and then updated (displaying the entry page again).
  7. Use entity beans, at least one session bean and a persistence unit to store persons and their contact details in a database (rather than the session-scoped managed bean).
    1. Hint: use the built-in Java DB.
  8. Add to the entry page the ability to search for people whose name equals a user-specified string.
    1. Extend the previous functionality to search for people whose name contains a user-specified substring.
    2. Extend the previous functionality to search for people for whom any of their name or contact details contains a user-specified substring.

At this stage it is not necessary to store the list of people and their contact details in a database.

 

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

 
The enterprise web programming modules include some material that was formerly part of the WEB1P and WEB2P units.