Added error checking to the servlet to handle bad input.