tiacex 2014-02-05 12:54 采纳率: 0%
浏览 2041

jsp页面ArrayList数据错误…求救求救啊啊,困扰几天了…



<%
ArrayList viewFile = (ArrayList)session.getAttribute("viewFile");
ArrayList storyFile = (ArrayList)session.getAttribute("storyFile");
ArrayList creativeFile = (ArrayList)session.getAttribute("creativeFile");
ArrayList varietyFile = (ArrayList)session.getAttribute("varietyFile");
%>
……
    <table border="0" width="680px">
            <tr bgcolor="#FF9900">
                <td colspan="3"><%=viewFile.get(0).fileType.getFileTypeName()%></td>
                <td align="right"><a href="FileListServlet?biaoshi=wu&typeId=1">更多>></a></td>
            </tr>
            <tr>
            <%
                for(int i=0;i<viewFile.size();i++){
                    FileInfo file = viewFile.get(i);
            %>
                <td>
                    <table border="0" align="center">
                        <tr>
                            <td align="center">
                                <a href="showFileInfo.jsp?jihe=viewFile&id=<%=file.getFileId()%>">
                                <img src="uploadfiles/<%=file.getPic1() %>" width="150" height="180" border="0"/>
                                </a>
                            </td>

                        </tr>
                        <tr>
                            <td>
                              <a href="showFileInfo.jsp?jihe=viewFile&id=<%=file.getFileId()%>">
                                <%=file.getFileTitle() %>
                               </a>
                            </td>

                        </tr>

                    </table>
                </td>   
            <%
                }
             %> 
            </tr>

……
……

 ***结果:***

//<%=viewFile.get(0).fileType.getFileTypeName()%>这句报错,里面viewFile就是ArrayList
类型的…有ArrayList的页面就有错误…

org.apache.jasper.JasperException: java.lang.NullPointerException
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:491)
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)
root cause

java.lang.NullPointerException
org.apache.jsp.show_jsp._jspService(show_jsp.java:96)
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)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.29 logs.

  • 写回答

2条回答 默认 最新

  • Novice起航 2014-02-06 08:08
    关注

    查查相应的servlet里有没有写绑定名称为viewFile的session,还有转发的语句有写吗?

    评论

报告相同问题?

悬赏问题

  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集