CmpSc 421, Spring 20132 , AJAX Assignment

For this assignment, you will use both client-side validation, AJAX, and a Java Servlet to do a version of Exercise 39.5 from Liang's text, 8e.

Client-side Validation:

The user inputs must conform to the following specifications:

Loan Amount: A whole number dollar amount in the range 3000-250000, inclusive.

Annual interest rate: A floating-point percentage in the range from 3.00 to 10.00, inclusive. If the user provides extra decimal places, round to the nearest hundredth, and place this value in the text field before submission to the server.

Number of Years: One of 1,2, ..., 7, 10, 12, 15, 20, 25, and 30. This would best be chosen from a <select> that has no default value.

You must "flag" input errors on the client-side, so that no invalid data is sent to the server. The error messages must show up to the right of the input fields, in red; do not use JS alerts for this! You may want to look at the article, Form Validation on the Client Side.

AJAX and the Servlet

Use an XmlHttpRequest object (or Microsoft equivalent) to send the validated form data, as name/value pairs, to the server via GET . Your servlet will use Liang's Loan.java class to calculate the monthly and total payments, format them as currency, and then return them as XHTML that your AJAX callback function can place in a <div> to the right of the input form.

Deliverables:

  1. Please name your project AJAXAssignment and place the entire project in your drop folder no later than noon on Thursday, Feb 28.
  2. Get screen shots that show client-side error checking as well as calculated loan values. Make sure that the error checking illustrates empty inputs, invalid data types, and out of bounds inputs.
  3. Complete one integrity statement for the entire project and date and sign it.
  4. At the beginning of class on Thursday, Feb. 28, turn in collated and stapled copies of your integrity statement, the HTML, CSS, JavaScript, and servlet files, and the screen shots specified in 2, above.