Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2008
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    error :java.lang.NullPointerException in searchuser.jsp page

    Hi,
    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;
    Class.forName("com.mysql.jdbc.Driver");
    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")%>
    </option>
    <%
    }

    }
    finally
    {
    if (rs != null)
    {
    rs.close();
    rs = null;
    }
    if (st != null)
    {
    st.close();
    st = null;
    }

    }
    %>
    but shows error at above marked line as:

    java.lang.NullPointerException
    org.apache.jsp.searchuser_jsp._jspService(searchuser_jsp.java:91)

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

  • #2
    Senior Coder
    Join Date
    Dec 2005
    Location
    Slovenia
    Posts
    1,958
    Thanks
    120
    Thanked 76 Times in 76 Posts
    by useid Asc .. u got miss typed query, that field does no exists I presume.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •