是这样的,我用的是Intellij 导入了一个MyEclipse的包(该包已部署在服务器上,所以是没有大错误的)。
然后在一个jsp文件出现了个问题:
莫名奇妙地println变成了红色,执行的时候就直接抛出异常了。
今天刚接触JavaWeb不太懂,到底是怎么回事呢?
异常:
type Exception report message An exception occurred processing JSP page /blackphones.jsp at line 15 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 /blackphones.jsp at line 15 12: <% 13: String [] phones = (String []) request.getAttribute("blackphones"); 14: 15: out.println("褰撳墠鏈� + phones.length + "涓墜鏈哄彿鐮侊細
"); 16: 17: for(String phone : phones){ 18: out.println(phone + " "); Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:575) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:477) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339) javax.servlet.http.HttpServlet.service(HttpServlet.java:731) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) com.aspire.mmlite.server.servlet.LogFilter.doFilter(LogFilter.java:63) root cause java.lang.NullPointerException org.apache.jsp.blackphones_jsp._jspService(blackphones_jsp.java:96) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:731) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:439) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339) javax.servlet.http.HttpServlet.service(HttpServlet.java:731) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) com.aspire.mmlite.server.servlet.LogFilter.doFilter(LogFilter.java:63)
字符串数组没有实例化一个大小给它~length属性是空的
鼠标移动到红色代码上看看提示什么?