Jun 15th, 2011, 03:10 AM
HELP! JSP Server validation!!
Create Q5Action.jsp that displays a Web page similar to Fig 5-1. When the user clicks on the "Calculate Instalment" button, the page returns a message box displaying the relevant loan information and the monthly instalment. The normal output should be similar to Fig 5-2.
The formula for calculating the monthly instalment is given follow. The Loan Period is either 1, 2, 3, 4, 5, 6, 7, 8 or 9 years.
Loan Amount = Car Sales Price - Booking Fees - First Payment
Monthly Instalment = (Loan Amount + (Loan Amount * Interest Rate * Loan Period))/ (Loan Period * 12)
The solution should also perform the necessary input validation at the server-end and avoid run time error due to invalid input. In addition, the solution should also check that the loan amount should not exceed 90% of the Car Sales Price.
In case of any invalid input, the input form will be redisplayed (with appropriate error message) similar to Fig 6-3.
Fig 5-1 Initial Display of Q5Action(THIS ONE I KNOW!!)
Fig 5-2 Normal Display after submission of a set of valid input. (THIS ONE I KNOW!!)
Take note that the use can click on the „Back to Car Loan Calculator‟ to bring up the initial display again.
*THIS IS THE PART WHICH I DO NOT KNOW HOW TO VALIDATE USING SERVER SIDE!!! PLEASE HELPPP!!!!
Fig 5-3 Display after submission of a set of input with missing or invalid input
As depicted in the above screen shot, the Error message pointed out all the three input fields were invalid. It is obvious that, Car Sales Price should not be a negative value; Booking Fees can not be „none‟ (which is not a number) ; and First Payment cannot be blank.