While you didn't say how it's not working (what is it supposed to do, and what does it do instead, and what have you done so far to debug the issue), a few things jump out.
#1 - You absolutely, positively should not declare Java classes in JSPs. Put those classes into WEB-INF/classes where they belong.
#2 - All DB code that does anything seems to be commented out. The code tags I added to your post make that easy to see (please UseCodeTags in the future when you post code of any length).
#3 - What's with the threads? Should the DB operations not be carried out out right away? But regardless of what it is supposed to do, it almost certainly won't work the way you hope it will work; best to get rid of all that.
There's a lot more to criticize in that code. I would suggest you extract it from that JSP -- where as already said, it doesn't belong -- and post it in one of the Java forums. I would just start by pointing out this:
Don't do that. When exceptions are thrown, you won't know about them and you will just have unexplained behaviour.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com