请各位高手解决一下这个JSP问题
这段代码,我执行时出错如下;
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:358)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
root cause
java.lang.NullPointerException bean.jdbcBean.closeDB(jdbcBean.java:41)
org.apache.jsp.checkout_jsp._jspService(checkout_jsp.java:172)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
note The full stack trace of the root cause is available in the Tomcat logs.
源码:
<%@ page contentType= "text/html; charset=gb2312 " language= "java " import= "java.sql.* "
errorPage= " " %>
<!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=gb2312 ">
<title> 网上碟店:碟碟不休 </title>
</head>
<body>
<%@ include file= "header.jsp "%>
<table width= "800 " height= "400 " border= "1 " align= "center ">
<tr>
<td> <%
Vector buylist = (Vector)session.getValue( "shopcar ");
if(buylist==null||buylist.size() <1)
{
%>
<jsp:forward page= "mydisk.jsp "> </jsp:forward>
<%}
String userid = (String)session.getValue( "uid ");
float pricenum =0;
for(int i=0;i <buylist.size();i++)
{
Disk disk = (Disk)buylist.elementAt(i);
pricenum = pricenum + disk.getBuynum()*disk.getPrice();
}
jdbcBean diskBean1=new jdbcBean();
String sql1= "INSERT INTO myorder(user_id, price_num, order_time) VALUES( ' "+userid+ " ', "+pricenum+ ", ' "+current_time+ " ') ";
int m=diskBean1.executeUpdate(sql1) ;
diskBean1.closeDB();
jdbcBean diskBean2=new jdbcBean();
String sql2= "SELECT order_id FROM myorder WHE