• 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 Combo Boxes in JSP & Servlet

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic