日期:2014-05-17  浏览次数:20698 次

{推荐} 新人 index.jsp空指针错,求大神解释
exception

org.apache.jasper.JasperException: Exception in JSP: /index.jsp:234

231:         <table width="100%" border="0" cellspacing="1"
232:  cellpadding="1" class="tableBorder">
233:  <%
234:  Iterator iter = pl.iterator(); 
235: 
236:  while (iter.hasNext()) {
237:  Project pro = (Project) iter.next();

Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
cn.edu.bit.servlet.EncodingFilter.doFilter(EncodingFilter.java:66)
root cause

java.lang.NullPointerException
org.apache.jsp.index_jsp._jspService(index_jsp.java:302)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
cn.edu.bit.servlet.EncodingFilter.doFilter(EncodingFilter.java:66)

------解决方案--------------------
感觉pl是null
------解决方案--------------------
system.out.println(pl); 估计集合木有东西,未判断空就用来迭代
------解决方案--------------------
空指针异常,很有可能是你的pl为nill,用断点查看一下就知道了,输出也试试,
------解决方案--------------------
你要的现在是null