weixin_慕UI2156548
2019-05-31 17:30
for(int i=0; i < favorites.length; i++)
{
out.print(favorites[i]+" ");//有错误
}
类型异常报告
消息 在第36行处理JSP页面/request.jsp时发生异常
description 服务器遇到内部错误,导致无法完成此请求。
例外
org.apache.jasper.JasperException:在第36行处理JSP页面/request.jsp时发生异常33:鐖卞ソ锛%%%%%34:if(request.getParameterValues(“favorite”)!= null){35:String [] favorites = request.getParameterValues(“favorites”);36:for(int i = 0; i <favorites.length; i ++)37:{38:out.print(收藏夹[i] +“&nbsp;&nbsp;”); //链接璇璇 39:}堆栈跟踪: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:579) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:476) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
根本原因
显示java.lang.NullPointerException org.apache.jsp.request_jsp._jspService(request_jsp.java:157) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
note备注 根本原因的完整堆栈跟踪在Apache Tomcat /8.0.43日志中。
if(request.getParameterValues(“favorite”)!= null)
改成
if(request.getParameterValues(“favorites”)!= null)
加一个判断语句,
if(request.getParameterValues("favorite") != null)
JAVA遇见HTML——JSP篇
248277 学习 · 3071 问题
相似问题