Project N - Java servlets

Extra Credit

Part 1 - Preparation - Tomcat / Eclipse / servlet tutorial

Please do the tutorial Using the Eclipse Web Tools Platform with Apache Tomcat. The tutorial is written for Eclipse 3.3 (Europa), there are some small differences for Eclipse 3.4 (Ganymede):

Part 2 - Calculator servlet

Build a servlet that calculates a mathmatical result of two inputs and a selected operator.

Save the provided HTML file, as "calculator.html", to the wtp-tutorial/WebContent directory that you created during the tutorial. Then create a new servlet, named CalculatorServlet, that gets the two inputed numbers (fields named "operand1" and "operand2") and the desired operand and calculates the result. Treat the input fileds and the result as "float"s.

Sample input and output

Here is several examples of input and output for the severlet.
sample 1 input
sample 1 output
sample 2 input
sample 2 output
sample 3 input
sample 3 output
sample 4 input
sample 4 output

Turnin

Zip up the wtp-tutorial folder and email it to me. It should include all of the tutorial files and the calculator files.

Legend: method/function keyword literal

Valid XHTML 1.0! Valid CSS!