I am creating the updateuser.jsp page. For that I create search.jsp where one can serch users and after submitting this page.it should display the updateuser.jsp page where I can update the details of user. Here is my code of searchuser.jsp:

<% Connection connection = null;
        Statement st = null;
        ResultSet rs = null;
        Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/mynewdatabase","root", "root123");
    ///  st=connection.createStatement();/// 
           try {
        rs = st.executeQuery("Select * from user order by useid Asc");
                           while (rs.next())
                                <option value = "<%=rs.getString("userid")%>" >
                                <%=rs.getString("emailid") + " "+rs.getString("groupid")%>

                           if (rs != null)
                               rs = null;
                           if (st != null)
                               st = null;


but shows error at above marked line as:


Well, whether it is right way to retrive data and shows to user?
Any suggestion is highly appreciated.
Thanks and Regards

Of course it will, you declares connections as

Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/mynewdatabase","root", "root123");

but you trying to call it as


You should seriously look into some materials on Java web development Java EE5 Tutorial and JDBC Database Access may help you too. As I said previously accessing database from JSP is bad thing to do

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.