This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using Combo Boxes in JSP & Servlet

 
roopa chakra
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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64692
86
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic