Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

rs.getstring not working.

 
swapna jhanjhar
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm facing one strange problem. Donno the reason for the error.
I've one jsp page where I'm showing few values from db.
The servlet returns one resultset which has (say) name and id cols.
I've one hidden field and 2 textboxes.
if i'm doing in jsp page

it's throughing error that "no data found"

whereas

tis works fine..
From this it seems that we cant retrieve value from one RS column more than once.,...
can anyone please let me know the reason...and how can i achieve the same ???
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 35977
422
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some database drivers don't let you retrieve a column more than once. The solution is to store it in variable.

Note that it is considered horrible practice to have JDBC code inside a JSP. It is better to call JDBC from a class called indirectly from your servlet and store the results in a request attribute. Then the JSP reads that attribute.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!