Lab Assignment #8 (Servlets)

In this lab, you will create a web page with a form that will be processed using Java. The guidelines are the same as in Lab #2 and in Homework #10, and you can re-implement the same thing here as you did there. Your page must have at least two text input fields, one intended for a text input and one for a numerical input. There must also be a submit button, and when the user presses the submit button, the script should do something using both inputs, and one of the inputs should be modified in some way before being returned. As in Homework #10, all of your inputs must be validated. This means that the script must require that both entries be filled out and that the numerical input only contains a number. Your script should also make sure that the user didn't leave any of the fields blank. For now, don't worry about multiple values for single variables or about escaping or stripping special HTML characters. (Although it'd probably be good practice to figure out how to deal with those situations!)

This assignment is due Wednesday, July 23rd before class.

You may find the HttpServletRequest method getParameter() useful for obtaining the environment variables. Note that this will return null if the variable isn't set (for example, when the page is first loaded) and it will return the empty string "" if the user doesn't fill out the field. Your app should be able to deal with both possibilities.