当前位置: 代码迷 >> Java Web开发 >> <jsp:forward page="details.jsp"/>报错,该如何处理
  详细解决方案

<jsp:forward page="details.jsp"/>报错,该如何处理

热度:1045   发布时间:2016-04-17 10:31:09.0
<jsp:forward page="details.jsp"/>报错
<%-- 
  Document : vote
  Created on : 2011-9-15, 15:56:46
  Author : Administrator
--%>

<%@page contentType="text/html" pageEncoding="GB2312"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  "http://www.w3.org/TR/html4/loose.dtd">

<%@page language="java" import="java.sql.*"%>
<jsp:useBean id="connDbBean" scope="page" class="vote.VoteConn"/>
<%
  String rb = request.getParameter("type");
  if(rb != null && rb != "") {
  String sql = "update vote Set c_num=c_num+1 where id=" + rb;
  connDbBean.executeUpdate( sql );
  }
%>
<jsp:forward page="details.jsp"/>



报错:
HTTP Status 500 - 

--------------------------------------------

type Exception report

message 

description The server encountered an internal error () that prevented it from fulfilling this request.

exception 

org.apache.jasper.JasperException: An exception occurred processing JSP page /vote.jsp at line 20

17: connDbBean.executeUpdate( sql );
18: }
19: %>
20: <jsp:forward page="details.jsp"/>


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:401)
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)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)


root cause 

org.apache.jasper.JasperException: An exception occurred processing JSP page /details.jsp at line 28

25: <%
26: // 获取总票数
27: ResultSet tmpRs = connDbBean.executeQuery("select sum(c_num) As totalnum from vote");
28: tmpRs.next();
29: tot_num = tmpRs.getInt("totalnum");
30: tmpRs.close();
31: ResultSet rs = connDbBean.executeQuery("select * from vote");


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
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)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:706)
org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:677)
org.apache.jsp.vote_jsp._jspService(vote_jsp.java:79)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
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)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)


root cause 

java.lang.NullPointerException
org.apache.jsp.details_jsp._jspService(details_jsp.java:86)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
  相关解决方案