当前位置: 代码迷 >> Java Web开发 >> org.apache.jasper.JasperException: java.lang.NullPointerException,该怎么处理
  详细解决方案

org.apache.jasper.JasperException: java.lang.NullPointerException,该怎么处理

热度:8852   发布时间:2013-02-25 21:15:17
org.apache.jasper.JasperException: java.lang.NullPointerException
org.apache.jasper.JasperException: java.lang.NullPointerException
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:538)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:370)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

代码,是个空页面,想要测试一下,但是出错了
<%@ page language="java" contentType="text/html; charset=gbk"
  pageEncoding="gbk"%>
<%@ page import = "java.sql.*" %>

<% 
Class.forName("com.mysql.jdbc.Driver");
String url = "jdbc:mysql://localhost:3306/bbs?" + "user=root&password=123";
Connection conn = DriverManager.getConnection(url);
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<title>Insert title here</title>
</head>
<body>

</body>
<%
conn.close();
 %>

------解决方案--------------------------------------------------------
我新手,你看你是否在项目中引入相应的包。
nullPonintException,或许是你没有引入相应的包,或者就是你调用出问题了。你用的编译器没有提示吗?
  相关解决方案
本站暂不开放注册!
内测阶段只得通过邀请码进行注册!