File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes jsp project Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "jsp project" Watch "jsp project" New topic

jsp project

ritesh srivastav

Joined: Nov 30, 2012
Posts: 8
i want to to create a jsp page where it count the user hits and save in database.......i hve tried to write tht code but its nt work.

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
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.
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

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 agree. Here's the link:
subject: jsp project
It's not a secret anymore!