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

Data from database not being displayed in JSP

 
Vishal Hegde
Ranch Hand
Posts: 1077
Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I showed this code to one of my collegue who is a software engineer..the database connection , the table the data in it all are correct, but he also was not able to trace the issue as of why data is not being displayed in the jsp page below is the code....


 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64633
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If this Java code was in a class, rather than following the really bad practice of placing it in a JSP, it'd be a lot easier to debug and test. That's the first step I'd take.
 
Vishal Hegde
Ranch Hand
Posts: 1077
Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I Debugged this in netbeans and i got this below message
 
Paul Clapham
Sheriff
Pie
Posts: 20774
30
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't even think that should compile. Line 25, for example, isn't valid Java code.

But that's just one of the things you have to deal with when you use scriptlets. If you had put that code in a Java class, where it belongs, you would have tried to compile it and found out right away that there was bad code in it. But when you put it in a JSP, you get messages in a log file, and you might get an error page depending on whether you configured an error page into your application. Which you probably didn't.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic