aspose file tools*
The moose likes JSP and the fly likes Using Combo Boxes in JSP & Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Using Combo Boxes in JSP & Servlet" Watch "Using Combo Boxes in JSP & Servlet" New topic
Author

Using Combo Boxes in JSP & Servlet

roopa chakra
Greenhorn

Joined: Jul 12, 2005
Posts: 13
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.


roopa chakra
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using Combo Boxes in JSP & Servlet