| | |
error :java.lang.NullPointerException in searchuser.jsp page
Please support our JSP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Jun 2008
Posts: 38
Reputation:
Solved Threads: 0
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:
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
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:
JSP Syntax (Toggle Plain Text)
<% 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"); [COLOR="Red"]/// st=connection.createStatement();///[/COLOR] 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; } } %>
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
Last edited by peter_budo; Jul 10th, 2008 at 5:28 am. Reason: Keep It Organized - please use [code] tags
Of course it will, you declares connections as
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
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/mynewdatabase","root", "root123");st=connection.createStatement();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
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
![]() |
Other Threads in the JSP Forum
- Previous Thread: help jsp vista home premium
- Next Thread: Error while retrieving data from the drop down list
| Thread Tools | Search this Thread |
apache backbutton combobox connection database development directorystructure dynamicpagetitles eclipse frames glassfish ie8 imagetodatabse imageupload integer internet java javaee javascript jsf jsp jsppagetitles levels mvc2 mvcmodel2 network parameters passing ping printinserverinsteadofclient redirect request.getparameter response servlet servletdopost()readxml sessions software ssl state_saving_method stocks sun tomcat tutorial update video web






