Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlets with JDBC connection

 
Madhawi Maurya
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

I got a problem while making a servlet program. Please help me.

My problem is:

When i am loading mySQL driver in my servlet program, run time error "ClassNotFoundException" is coming. But when i load same driver in my simple program using main() method, it runs successfully.

Please tell me why this problem is coming with servlet program and also give me the solution.

Thanks & Regards,
Madhawi
 
Vassili Vladimir
Ranch Hand
Posts: 1585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Include MySQL driver's JAR file in your class path, that's all!!!
 
Madhawi Maurya
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Vassili Vladimir:
Include MySQL driver's JAR file in your class path, that's all!!!


Thank you Vassili.
[/LIST]
 
Madhawi Maurya
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But After loading the driver i got another problem.

I have created a html file in which two fields login and password has mentioned. when i submit the html file, the servlet page will open, the servlet page will store the login and password in database and after that it will display all content of my login table.

Problem is that, when i submitting my html file it opens a download dialog box, from that box i can open a file or save a file or can cancel the further process. when I select open, I have to choose a file type in which i can see my output, I choosed internet explorer. And it is showing the output of my sevlet file. Can it show directly without open with or save as option?

My Servlet program is as follows:




[BSouther: Added UBB CODE tags]
[ October 13, 2007: Message edited by: Ben Souther ]
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have a typo in the content type; it should be "text/html".
 
Madhawi Maurya
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ulf Dittmer:
You have a typo in the content type; it should be "text/html".


thanks for the help to aware my mistake at content type.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic