Go4Expert

Go4Expert (http://www.go4expert.com/)
-   JSP (http://www.go4expert.com/forums/jsp/)
-   -   Displaying data from mysql database. (http://www.go4expert.com/forums/displaying-data-mysql-database-t11957/)

guravharsha 8Jul2008 19:18

Displaying data from mysql database.
 
Hi,
In main.jsp i wish to display the data from the database( user information stored in user table ). my codein main.jsp is:

<h2> description about user:</h2>
<% Statement st = null;
ResultSet rs = null;

rs = st.executeQuery("Select description from user ");
%>
<option value = "<%=rs.getString("description")%>" >
</option>
when i run the above code it shows the error:
java.lang.NullPointerException
org.apache.jsp.main_jsp._jspService(main_jsp.java: 72)
like at above red color line
can anybody have solution for above or any alternative code.
Thanks and regards
Haresh

XXxxImmortalxxXX 10Jul2008 11:48

Re: Displaying data from mysql database.
 
well you are calling the method on an object (st) reference set to NULL doesnt make any sense to me
that code is going to throw a NullPointerException.


All times are GMT +5.5. The time now is 04:33.