当前位置: 代码迷 >> Java Web开发 >> 关于空指针异常的请问
  详细解决方案

关于空指针异常的请问

热度:10125   发布时间:2013-02-25 21:14:27.0
关于空指针错误的请教
报错的信息如下:
description The server encountered an internal error (An exception occurred processing JSP page /menu_advertisement_info_1.jsp at line 88 85: 86: 87: <% 88: for(int i=0;i<adinfos.size();i++){ 89: AdInfo adinfo = (AdInfo)adinfos.get(i); 90: %> 91: <tr class="Label1_text_blue" id="row1" align="center"> Stacktrace:) that prevented it from fulfilling this request.

exception 

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

85: 
86: 
87: <% 
88: for(int i=0;i<adinfos.size();i++){
89: AdInfo adinfo = (AdInfo)adinfos.get(i);
90: %>
91: <tr class="Label1_text_blue" id="row1" align="center">


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)


root cause 

java.lang.NullPointerException
org.apache.jsp.menu_005fadvertisement_005finfo_005f1_jsp._jspService(menu_005fadvertisement_005finfo_005f1_jsp.java:154)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)


note The full stack trace of the root cause is available in the Apache Tomcat/7.0.29 logs.

出错的JSP页面如下 , 两天了一直没找出问题所在,麻烦大虾们帮忙看看:

XML code
<%@page import="java.sql.ResultSet"%><%@page import="com.bean.hotel.service.AdInfoService"%><%@page import="com.bean.hotel.dto.AdInfo"%><%@page import="java.util.List"%><%@ page language="java" contentType="text/html; charset=UTF-8"    pageEncoding="UTF-8"%>   <!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=UTF-8"><title>广告信息管理</title><style type="text/css">@import url("style/style.css");@import url("style/calendar.css");</style></head><body><form name="form1" method="post"><table width="90%"><tr>  <td width="499"><img src="images/icon_point.gif" width="12" height="12"><a class="title">酒店广告信息-管理</a></td>  <td colspan="2" align="right"><img src="images/icon_point.gif" width="12" height="12"><a class="title" href="advertisement_info_1">添加广告信息</a></td></tr>  <tr>    <td>广告主:            <select name="select" id="select">        <option>可口可乐</option>        <option>雪碧</option>      </select></td>    <td width="285" align="left">代理公司:      <select name="select2" id="select2">        <option>可口可乐</option>        <option>雪碧</option>      </select></td>    <td width="310" align="right">广告类型:      <select name="select3" id="select3">        <option>视频广告</option>        <option>图片广告</option>      </select></td>    </tr>  <tr>    <td>更新时间:      从        <input type="text" name="textfield" id="textfield" size="15">      到      <input type="text" name="textfield2" id="textfield2" size="15"></td>    <td align="left">&nbsp;</td>    <td align="right"><img src="images/btn_search.gif" width="70" height="25"></td>    </tr>                                                                     </table>  <table width="95%" height="80" border="0" cellpadding="3" cellspacing="1" class="table1" id="targettable">                      <tr class="Label1_top" id="to">              <td width="8%" >广告ID</td>              <td width="8%" >广告主</td>              <td width="9%" >广告代理公司</td>                 <td width="9%">广告产品</td><!--<td width="8%">视频名称</td>--><td width="11%">广告种类</td><td width="12%">视频路径/图片名</td><td width="8%">更新时间</td><td width="17%"  >操作</td>    </tr> <%AdInfoService ais = new AdInfoService();List adinfos = ais.listAlladinfos();%><% for(int i=0;i<adinfos.size();i++){AdInfo adinfo = (AdInfo)adinfos.get(i);%><tr class="Label1_text_blue" id="row1" align="center">      <td width="8%"><%= adinfo.getAdID() %></td>        <td width="8%"><%= adinfo.getAdMasterID() %></td>     <td width="9%"><%= adinfo.getAdCompanyID() %></td>        <td width="9%"><%= adinfo.getAdProduction() %></td>                 <td width="8%"><%= adinfo.getAdType() %></td>             <td width="11%"><%= adinfo.getAdName() %><td width="12%">                    <td width="8%"><%= adinfo.getUpdateTime() %><td width="17%">                        <a href="advertisement_info_S">编辑</a> <a href="#">删除</a>                  </td>            </tr><%}%>                </table>              </table>            </form></body></html>
  相关解决方案
本站暂不开放注册!
内测阶段只得通过邀请码进行注册!
 
  • 最近登录:Sun Dec 16 07:27:17 CST 2018
  • 最近登录:Sun Dec 16 07:27:17 CST 2018
  • 最近登录:Sun Dec 16 07:27:17 CST 2018
  • 最近登录:Sun Dec 16 07:27:17 CST 2018
  • 最近登录:Sun Dec 16 07:27:17 CST 2018