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,还有转发的语句有写吗?

    评论

报告相同问题?

悬赏问题

  • ¥15 运筹学中在线排序的时间在线排序的在线LPT算法
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 lammps拉伸应力应变曲线分析
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试,帮帮忙吧