Java开发网 |
注册 |
登录 |
帮助 |
搜索 |
排行榜 |
发帖统计
|
您没有登录 |
» Java开发网 » Servlet/JSP/JSF/JavaFX Script
打印话题 寄给朋友 订阅主题 |
作者 | 菜鸟问题,希望大虾们帮助 |
J2EE1982
发贴: 7 |
于 2005-08-16 07:42
jsp:源程序 <%@ page language = "java" contentType = "text/html;charset=ISO-8859-1" %> <%@ page import = "java.sql.*" %> <jsp:useBean id="mysql" scope="page" class="com.Mysql" /> <% ResultSet rs = mysql.executeQuery("select * from stsnews"); while(rs.next()) { out.println(rs.getString("title")); } %> 错误:type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jasper.JasperException org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) root cause java.lang.NullPointerException org.apache.jsp.index_jsp._jspService(index_jsp.java:59) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) 菜鸟请教,基本程序调试不通,急急急急急急!!! |
作者 | Re:菜鸟问题,希望大虾们帮助 [Re:J2EE1982] |
chengbd
版主 发贴: 687 |
于 2005-08-17 01:12
java.lang.NullPointerException 这是运行时错误了,没看到你的DB连接代码,应该是rs是个null值,却执行rs.next(),就出错了。 应该 ResultSet rs = mysql.executeQuery("select * from stsnews"); if(rs==null){ } else { while(rs.next()) { out.println(rs.getString("title")); } } 知难而进 搞笑QQ图片 |
已读帖子 新的帖子 被删除的帖子 |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |