This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

get data from database  RSS feed

 
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to retrieve values from database to drop down box in servlet .I want database values in place of a and b.

 
Saloon Keeper
Posts: 4745
117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Once you have retrieved the values from the DB you can use them however you like, including using them in a servlet. What do you have so far, and where are you stuck making progress?
 
rakhi sinha
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Moores wrote:Once you have retrieved the values from the DB you can use them however you like, including using them in a servlet. What do you have so far, and where are you stuck making progress?



I am using this code but drop down box is empty.


 
Tim Moores
Saloon Keeper
Posts: 4745
117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The out.println statement looks completely messed up. It seems that you're printing a Java statement to the HTML output. I think you're missing some double quotes in there, and you shouldn't repeat the "out.println" part.

Also, you've checked that the ResultSet is not empty, yes?
 
rakhi sinha
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Moores wrote:The out.println statement looks completely messed up. It seems that you're printing a Java statement to the HTML output. I think you're missing some double quotes in there, and you shouldn't repeat the "out.println" part.

Also, you've checked that the ResultSet is not empty, yes?



I have checked the resultset....it is not empty.
I am usingfollowing loop.
while(rs.next())
{
out.println(" <option value="+ rs.getString("NO")+" ></option>");

}
 
Tim Moores
Saloon Keeper
Posts: 4745
117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So it's working now?
 
rakhi sinha
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Moores wrote:So it's working now?




yes it is working now..
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!