View Full Version : to retreive datas from mysql table in jsp

preethi A
04-10-2008, 11:29 AM
I am trying to put a combo box using jsp and i want to retreive the datas from my sql table and display those inside combobox.I have tried the below code.but it displays nothing inside combobox.

<%@ page import="java.sql.*" %>
<%@ page language="java" %>
<tr align=left><td>Location</td><td><SELECT NAME="location" onChange="disp_text() ">
<option value="">--- Select Location ----</option>



Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/conference", "meetme", "meetme");
Statement st = conn.createStatement();
ResultSet rs=st.executeQuery("select * from meetme");
out.println("Values:" + rs.next());

<option value="<%=rs.getString("location")%>"><%= rs.getString("location") %> </option>



catch(Exception e)

e.printStackTrace(new PrintWriter(out));

please help me to solve this.


04-10-2008, 11:53 AM
does your table have any data? are you getting any error messages?

preethi A
04-10-2008, 12:19 PM
yes, i am having records in the table meetme which is in conference database.I am not getting any error message

preethi A
04-11-2008, 07:27 AM
Thank you shyam.my problem is solved.It is because of missing mysql jar file