• 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

Using Combo Boxes in JSP & Servlet  RSS feed

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need to display database table column values on JSP page whenever a user selects particular column name from Combo Box.I have dynamically populated column names in the Combo box. Below is the code.

<%
ResultSetMetaData rsmd = rs.getMetaData();

out.println("<SELECT>");
for(int i=1;i<=rsmd.getColumnCount();i++)
{
out.println("<OPTION>"+rsmd.getColumnName(i)+"<OPTION>");

}
out.println("</SELECT>");
%>
Now the problem is I am not getting how to display particular column values
based on the selected combobox value.

Could anybody give me an approach.
 
Author and ninkuma
Marshal
Posts: 66797
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just as in hand-written HTML, use the selected attribute on the appropriate option element.

Oh, and an HTML select element isn't a "Combo Box" so it's confusing to refer to it as so.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!