MyException - 我的异常网
当前位置:我的异常网» Java Web开发 » 请解决一下这个JSP有关问题

请解决一下这个JSP有关问题

www.MyException.Cn  网友分享于:2013-09-12  浏览:8次
请各位高手解决一下这个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   WHERE   order_id= ' "+userid+ " '   AND   order_time= ' "+current_time+ " ' ";
ResultSet   rs=diskBean2.executeQuery(sql2)   ;  
rs.next();
String   orderid   =   rs.getString( "order_id ");
diskBean2.closeDB();  

for(int   j=0;   j <buylist.size();   j++)

文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有