• 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

using drop down list

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,
please tell me how to use drop down list in servlets, as i write a code in html, but it is a static list, i gave 4 or 5 elements and it displays, but i want to list that displays data from data base field.
i want that,when i insert data in database column the data automatically be viewed in that list.
please help.
tahnx.
 
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Shumaiza
i hope this code solves your problem
Assuming that you got the resultset
out.println("<html><body>");
out.println("<table>");
if(resultset.next()==false)
{
response.sendRedirect("somepage");
}
else
{
out.println("<select name=\"Location\">");
out.println("<option value=\" "+resultset.getString(1)+"\">+resultset.getString(1)+"</option>");
while(rest.next())
{
out.println("<option value=\" "+resultset.getString(1)+"\">+resultset.getString(1)+"</option>");
}
out.println("</select>");
}
out.println("</body></html>");
------------------
IBM Certified WebSphere Application Server V3.5 Specialist
[This message has been edited by Dharmesh Chheda (edited September 06, 2001).]
 
I just had the craziest dream. This tiny ad was in it.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic