This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
It's hard to follow the code, as it's completely unindented, and you didn't UseCodeTags. I have added those for the Java code, but without indentation it's too hard to read. Please edit your post to make it more readable.
As to the problem itself, you can probably get a good deal closer to the solution if you write the value that's causing the problem to a log file (maybe using System.out.println) before parsing it into an integer.
Finally, some notes about servlets (which have nothing to do with the problem at hand): 1) Servlets should not have constructors - all initialization should be done in the init method. 2) If the destroy method doesn't do anything, delete it. 3) The doGet and doPost methods do the same thing; that likely violates the HTTP specification.