Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-08-2008, 04:58 PM
Member
 
Join Date: Jul 2008
Posts: 1
Haresh gurav is on a distinguished road
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 abovered color line
can anybody have solution for above or any alternative code.
Thanks and regards
Haresh
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-08-2008, 08:18 PM
Senior Member
 
Join Date: Jun 2008
Posts: 181
masijade is on a distinguished road
Define your statement and don't use scriptlets in JSP (they're only really still there for backwards compatability use a bean).
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 07-09-2008, 03:54 AM
Eku Eku is offline
Senior Member
 
Join Date: May 2008
Location: Makati, Philippines
Posts: 191
Eku is on a distinguished road
where is your driver?
where is the connection string? You dont even have a connection. ^_^

And as masijade said, please avoid using scriptlets. You can also use Servlets ^_^
__________________
Mind only knows what lies near the heart, it alone sees the depth of the soul.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
database with mysql using the netbeans 6.0 kwesiaryee New To Java 2 05-02-2008 05:27 AM
MySQL Database and Java shaggymac Advanced Java 1 05-01-2008 10:01 PM
Help needed with updating mysql database SilentCodingOne New To Java 1 12-11-2007 11:23 PM
connecting to mysql database javagal NetBeans 2 08-04-2007 01:36 PM
Displaying different columns with database query jennybgh JavaServer Pages (JSP) and JSTL 0 08-02-2007 06:04 PM


All times are GMT +3. The time now is 04:06 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org