HTTP状态500 - 在第166行

时间:2015-12-31 01:05:44

标签: java jsp

我从mysql db获取考试详细信息到我的控制器,并使用ModelAndView.addAttribute(list)将该列表发送到UserExam.jsp。

我在jsp中打印该列表并出现以下错误。

这是错误。

type Exception report

message An exception occurred processing JSP page /WEB-INF/views/UserExams.jsp at line 166

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 /WEB-INF/views/UserExams.jsp at line 166

163:                                <tr>
164:                                    <td><%=temp.get(i).getExamName().toString()%></td>
165:                                    <td><%=temp.get(i).getExamDuration().toString()%></td>
166:                                    <td><%=temp.get(i).getExamStart().getDate() + "-" +     temp.get(i).getExamStart().getMonth()+1 + "-" + (temp.get(i).getExamStart().getYear() + 1900) %></td>
167:                                    <td><%=temp.get(i).getExamEnd().getDate() + "-" + temp.get(i).getExamEnd().getMonth()+1 + "-" + (temp.get(i).getExamEnd().getYear() + 1900)%></td>
168:                                </tr>
169:                                <%


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:728)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:168)
org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303)
org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1244)
org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1027)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:971)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)

root cause

java.lang.NullPointerException
org.apache.jsp.WEB_002dINF.views.UserExams_jsp._jspService(UserExams_jsp.java:255)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
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:728)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:168)
org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303)
org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1244)
org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1027)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:971)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)

UserExam.jsp(我收到错误的地方)

    <div class="table-responsive">
                        <table class="table table-condensed" style="color: #2C3E50">
                            <tr>
                                <th>Name</th>
                                <th>Duration</th>
                                <th>Start Date</th>
                                <th>End Date</th>
                            </tr>
                            <%
                                for (int i = 0; i < temp.size(); i++) {
                            %>
                            <tr>
                                <td><%=temp.get(i).getExamName().toString()%></td>
                                <td><%=temp.get(i).getExamDuration().toString()%></td>
                                <td><%=temp.get(i).getExamStart().getDate() + "-" + temp.get(i).getExamStart().getMonth()+1 + "-" + (temp.get(i).getExamStart().getYear() + 1900) %></td>
                                <td><%=temp.get(i).getExamEnd().getDate() + "-" + temp.get(i).getExamEnd().getMonth()+1 + "-" + (temp.get(i).getExamEnd().getYear() + 1900)%></td>
                            </tr>
                            <%
                                }
                            %>
                        </table>
                    </div>

请解决任何问题。

0 个答案:

没有答案