
Respected Sir, I am Sanjay Baniwal working in BHEL as a Software Developer as a trainee for One Year. And i have been given a Project in which i have to create a JSP page with a Drop Down List in which all the UserNames in the Account table from SQL Database should come Automatically whenever the JSP page is Requested. Kindly see to it as soon as possible. It's urgent.
Regards Sanjay Baniwal

<%@page import="java.sql.*"%>
<form method="post" action="../Servlet">
<%
String driver = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://localhost:3306/register";
String query = "select * from register";
ResultSet rs = null;
Connection conn = null;
Statement stmt = null;
try {
Class.forName(driver);
conn=DriverManager.getConnection(url, "root", "root");
stmt = conn.createStatement();
rs = stmt.executeQuery(query);
%>
<select name="select">
<%
while(rs.next()){
%>
<option value="<%=rs.getInt("id")%>"> <%=rs.getString("username")%> </option>
<%
}
}
catch(Exception e){}
%>
</select>
<input type="submit" value="submit">
</form>
For more information, visit the following links:

But sir i do not have the id column in my table than why we are writting getInt"id" in


Sir, It's been three days that i have not received any answer to my question that why we are writing getInt"id" in our code when i do not have any id column in my Account table.
Please sir reply as soon as possible.
with warm regards.

Respected Sir, I think that you did not get my question or you are not interested in answering my question .
Please sir go to my questions as soon as possible.
with Warm Regards Sanjay Baniwal
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.