This assignment will help you understand exception handling.
As a rule of thumb, any thing that can be done to a program WILL be done by somebody. This means that if you put up a text field expecting an integer input, a multiplicity of things will happen. Users will push enter with an empty field. Users will enter their name in the field. They will enter floating points. A robust program will handle these errors with an informative message.
Make an applet like this one, using a try/catch block to inform the user of good or bad input. Also pass the initial string for display via a parameter in your html file.