当前位置: 代码迷 >> Java Web开发 >> 关于JDBC的异常。求好心人帮忙解决
  详细解决方案

关于JDBC的异常。求好心人帮忙解决

热度:10240   发布时间:2013-02-25 21:21:37
关于JDBC的错误。。急,急,求好心人帮忙解决
严重: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
at com.javaBean.Conn.executeQuery(Conn.java:42)
at org.apache.jsp.personal_jsp._jspService(personal_jsp.java:98)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:386)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:88)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:864)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1665)
at java.lang.Thread.run(Unknown Source)


JSP页面:
<%@ page language="java" import="java.util.*" pageEncoding="GB2312"%>
<jsp:useBean id="Conn" class="com.javaBean.Conn" scope="page"/>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@page import="java.sql.*" %>
<html>
? <head>
? <base href="<%=basePath%>">
<meta http-equiv="Content-type" content="text/html;charset=gbk">
? <title>My JSP 'Cone.jsp' starting page</title>
? ?
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0"> ?
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->

? </head>
??
? <body>
?
? <%
? ResultSet rs=Conn.executeQuery("select *from wws");
? out.println("<table border='1' align='center'>");
? out.println("<tr><td>name</td><td>age</td><td>sex</td></tr>");
? while (rs.next()){
? out.println("<tr><td>"+rs.getString("name")+"</td><td>"+rs.getString("age")+"</td><td>"
? +rs.getString("sex")+"</td></tr>");}
? out.println("</table>");
  相关解决方案
本站暂不开放注册!
内测阶段只得通过邀请码进行注册!