• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem getting result on Page

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am working with a simple html page that makes a call to a servlet that accesses data from a database using JDBC. Everything seems to be working fine except when I hit the submit button on the html page. I get part of what I expect. I expect to see a html page with a table with information. I get the title of the cells but not the content from the query. I did a view source on that page and it seems like it breaks right after the cell titles are written. I executed a query from the command line and the database is connecting and I also get the results that "should" show up on th e screen. I tried it on IE as well as FireFox same thing happens. I was wondering if anyone had any suggestion of why this could be happening and what I need to do to fix it.


This is the Servlet Code:


This is the html code:


this is the result from the view source:


Any help is greatly appreciated!! Thank you
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to jsp since it is the server code giving you rpoblems and not the HTML formatting.

Eric
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A truncated HTML file is a sure sign that an exception was thrown by the server-side code that prevented it from completing.
 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Juding from your code and where it broke, it should be a driver issue. It never reached the statement. Check the stack trace printed out.
You also may want to catch the exception in an order like "ClassNotFoundException" for the driver, "SQLException" for query and "Exception" for all if you want. Or simply separate the code of loading the driver and the code to execute your query. And at the end, you want to close your statment(and resultset?)

Good luck.
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also rd is not declared anywhere. It looks like a misspelling of your resultset rs.
 
Jeanne Pierre
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank You so much to all who replied to this message. I was able to find the problem. I did not know that I had to shutdown Tomcat and then start it. that seemed to give me the missing pieces. Thank you so much again, it really means a lot to me that people are willing to help.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic