
hi sir, my name is logeswaran. I have a problem in jsp, that i need to get value like a person name from database into drop down list. please show me how to do it? thank you.
By the way, I'm using access database and coding JSP.

Follow these steps:
1)Go to the start->Control Panel->Administrative Tools-> data sources.
2)Click Add button and select the driver Microsoft Access Driver(*.mdb).
3)After selecting the driver, click finish button.
4)Then give Data Source Name and click ok button.
5)Your DSN will get created.
6) Restart your server and run the following jsp code.
<%@page import="java.sql.*"%>
<select>
<option value="--Select--">--Select--</option>
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:student");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("Select * from data");
while(rs.next()){
String str=rs.getString("name");
%>
<option value="<%=str%>"><%=str%></option>
<%
}
%>
</select>

thank you so much
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.