Web programming

Units WEB1P and WEB2P

Pre-SWS task 2009-2010s1

Preparation task (Task A)

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

  1. It must allow the user to specify the details of an online banking transaction.
  2. The information entered about a transaction must include the following:
    1. The source account number from which the amount is to be paid, which must be present and be an 8-digit number.
    2. The destination account number to which the amount is to be paid, which must be present and be an 8-digit number.
    3. The bank sort code for the source account. This must be in the format two digits, hyphen, two digits, hyphen, two digits, e.g. 43-27-92.
    4. The bank sort code for the destination account. This must be in the format two digits, hyphen, two digits, hyphen, two digits, e.g. 43-27-92.
    5. The name associated with the destination account, which must be present.
    6. The amount of money to be transferred as a number containing at least one digit before the mandatory decimal point, followed by exactly two digits.
  3. If the user enters a valid transaction, it is added to a list of transactions stored as a session variable. The list of a user's transactions (showing all the above details) is then displayed back to them.
  4. If the user enters an invalid transaction, the system indicates to the user where invalid data has been entered and provides them with an opportunity to correct it.

Validation of transactions (where possible) is to be done both at the client and at the server side.

The code you produce will form the basis for further development work on the day of the SWS. You will need to hand in the code you write for this exercise as part of the individual assessment of the SWS.

You may either:

Advice

  1. Think carefully about the design of objects to represent the entities. What properties should they have and what type should the properties be? What other operations (methods) should be applicable to each entity?
  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.*).

Deliverables

  1. There is no formal deliverable for this task, however you will need to bring an electronic version of your work along to the SWS.
 

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.